Forum Discussion

charmbrooksrunning's avatar
charmbrooksrunning
Copper Contributor
Apr 29, 2019
Solved

Conditional Formatting Multiple Cells/Columns Based on Previous Cells

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?

12 Replies

  • SergeiBaklan's avatar
    SergeiBaklan
    Diamond Contributor

    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.

    • charmbrooksrunning's avatar
      charmbrooksrunning
      Copper Contributor

      SergeiBaklan 

       

      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!

      • SergeiBaklan's avatar
        SergeiBaklan
        Diamond Contributor

        charmbrooksrunning , you are welcome

         

        If you add the column through this menu

        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.

Resources