Excel conditional formatting of row

conditional formattingmicrosoft excelworksheet-function

Can someone please tell me how to highlight multiple cells in a row based on some values in any one of a given number of cells?

For example, if in Row 2 any of the cells from D2 to L2 have value "A" or "B" or "C" then I want Row 2 font to be of color Blue.

I am using Microsoft Excel 2008 for Mac.

Best Answer

You can count the number of occurrences of "A", "B" and "C" in each row using COUNTIF, and then add the results together. If any of those values are present in a row, the sum should return a non-zero value.

Try this:

Go to Conditional Formating > New Rule > Use a formula to determine which cells to format

Enter this formula:

=(COUNTIF($D2:$L2, "A")+COUNTIF($D2:$L2, "B")+COUNTIF($D2:$L2, "C"))>0

Set your format and click OK.
Make sure that the Applies to box in the Conditional Formatting Manager window is set to =$D2:$L2, or the row(s)/range(s) that you wish to apply the conditions to.

These should also work:

=COUNTIF($D2:$L2, "A")+COUNTIF($D2:$L2, "B")+COUNTIF($D2:$L2, "C")

=COUNTIF(2:2, "A")+COUNTIF(2:2, "B")+COUNTIF(2:2, "C")
Related Question