SOLVED

Conditional Formatting Multiple Cells/Columns Based on Previous Cells

Copper Contributor

Hello,

I want to create conditional formatting that would highlight a cell based on the previous cell in the same row, and the formatting can be applied to the entire table. 

 

Example 1: I want cell F3 to be highlighted yellow if the current cell is greater than the previous cell AND the previous is not equal to zero. 

Example 2: If the previous cell was 0, and the current cell has a value, I want the cell to be highlighted green. 

Example 3: If the previous cell had a value, and the current cell is 0, I want the current cell to be highlighted red. 

 

Is this possible?

ConditionalFormatting.JPG

12 Replies
best response confirmed by charmbrooksrunning (Copper Contributor)
Solution

@charmbrooksrunning ,

 

That could be like

=(E2>D2)*(D2>0)*(COLUMN()<>COLUMN(INDIRECT("Table1[[#Headers],[f18]]")))

for the yellow rule and similar for other (see attached file). Last multiplier is to exclude first column, or you may apply rules to your table starting from the second column.

@Sergei Baklan 

 

Thank you so much for the help! It worked for me. 

 

Followup question: Is it possible to create an intuitive/automated version of this conditional formatting, that it will automatically format new columns added to the table? 

 

Again, thank you!

@charmbrooksrunning , you are welcome

 

If you add the column through this menu

image.png

conditional formatting range will be automatically expanded.

 

However, if you start adding data to the right of the table, new column will be added to the table automatically, but this time without the expanding of the conditional formatting range.

@Sergei Baklan 

 

Got it. Your solution really helped me a lot with my work project. Thanks again!

@Sergei Baklan can you automatically populate cell based on words? Example: if PASS if typed into cell it auto goes to green fill. And if FAIL if typed, it goes to red fill?

@CROSSCONNECTIONBWOOD 

Could you please clarify what do you mean under "goes to green fill"? Is it to change this cell color or move the content of the cell to another cell colored green?

The example below in the test result column. I was wondering that if it was possible that when PASS was typed or FAIL was typed that it would fill the cell with the appropriate color. 

 

@Sergei Baklan 

@CROSSCONNECTIONBWOOD 

Let assume your Test Result column is L. Select entire column and create conditional formatting rule with formula

=$L1="PASS"

it looks like this

image.png

Add same way another rule for "FAIL"

@Sergei Baklan thank you so much. This will save me so much time when processing my reports. You are great at this.

1 best response

Accepted Solutions
best response confirmed by charmbrooksrunning (Copper Contributor)
Solution

@charmbrooksrunning ,

 

That could be like

=(E2>D2)*(D2>0)*(COLUMN()<>COLUMN(INDIRECT("Table1[[#Headers],[f18]]")))

for the yellow rule and similar for other (see attached file). Last multiplier is to exclude first column, or you may apply rules to your table starting from the second column.

View solution in original post