简体   繁体   中英

compare data from two columns in google sheets

I want to format cells in column C based on the value for column B.

For instance:

B

.75

.75

.5

.25

When column C gets a value. I want the cell color to change to represent a < = or > value, like so:

C

.75 = green

.5 = yellow

.25 = red

.25 = green

How can I do this without putting in a formula specific to each cell? There could be any number of cells.

Start with one cell. Go to Format -> Conditional formatting . Do your three rules (if C1 greater than B1 , fill green, etc.):

Select the cell you wish to edit.

选择单元格

Under Format -> Conditional formatting :

条件格式按钮

The Conditional Formatting Window will open. You can select the rule you would like and add a formula as shown.

添加公式

After each one, there is a button at the bottom of the dialog for Add another rule . Make sure that you don't use fixed ( =$B$1 ) references in your formulas, but relative ones ( =B1 ). Once you have all three rules, click done. Test it to make sure it works like expected.

Now all you have to do is select the cell that has the conditional format ( C1 ) and click the Format Painter tool . Then just highlight any cells that you want to follow the same rules. Because you have relative references, the conditional formatting will shift (ie C2 will reference B2 and D2 will D1 will reference C1 ).

Google does all the hard work :)

Does that make sense?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM