Using conditional formatting with array formulas

A recent Quora question asked “How do I highlight the number closest to an initial number in a row in Excel?“.  The answer by Bill Jelen provides a good example of using conditional formatting with an array formula:

In my data, I have the Goal or Initial Number in column A. Then, there are 12 results in B:M of each row. Select B3:M16. Home, Conditional Formatting, New Rule, Use a Formula To Determine Which Cells To Format. The formula will be =ABS($A3-B3)=MIN(ABS($A3-$B3:$M3)). Click the Format button and choose your desired fill color or font color.

Note the single dollar sign before the $A, $A, $B, and $M are crucial to make this work. As Conditional Formatting evaluates each cell, those dollar signs make sure that the logic is always pointing at A for the Initial cell and the range of B:M for the other values which may or may not be closer.

Note: This was created using Office 365 Insider which has access to Dynamic Arrays.

When used for conditional formatting, this formula also works with non-Insider versions of Office 365, as can be seen in my example below:

This entry was posted in Arrays, Excel and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.