Google-sheets – How to change both the contents of a cell and its conditional formatting based on a cell in another column

google sheets

I would like to create a formula for column H using a date in column G. If the value in the G cell is less than 0 then the H cell should have the value "Over" and turn red, or if the G cell is more than 0 then the H cell states "Under" and turns green.

Is this possible?

Best Answer

Absolutely,

The formula for H is (write it in H1 and then copy for the whole column)

=IF(G1<0,"Over","Under")

Then go to menu Format > Conditional Formatting and set-up the formatting.

Apply to range: H:H
Format cells if... Text is exactly: Over

Add another rule

Apply to range: H:H
Format cells if... Text is exactly: Under

Formula =IF(G1<0,"Over","Under") means that if G is less than 0, then H will be Over. Otherwise (if G is more than 0 or equal), H will be Under. If you want to exclude 0, then you can use:

=IF(G1<0,"Over",IF(G1>0,"Under",""))