Search code examples
excelformattingconditional-statementsxlsx

Excel conditional formatting per row cells


Is it possible to create a conditional statement to do the following without having to create the conditional format for each row?

For each row, if row column D cell is less than the value of row column A cell I want it to highlight red. If row column D cell is greater than the value of row column A cell, I want it to highlight green.

Example:

if D1 < A1 Highlight RED
if D1 > A1 Highlight GREEN
if D2 < A2 Highlight RED
if D2 > A2 Highlight Green

and so on and so forth....

enter image description here


Solution

  • Assuming you want Column A's cells to highlight the color, set up your conditional formatting like this:

    Formula: =$D1>$A1 for Green, =$D1<$A1 for Red

    Then, make sure the "Applies To" range is correct (this is where I personally usually mess up):

    Applies to (for both): $A$1:$A$10

    enter image description here

    If you want the row to highlight, then the "Applies to" range is =$1:$10 or just =$A$1:$D$10.