Explanation

In this example, the goal is to highlight empty cells in the range C5:J16 with conditional formatting. This is a quick and easy way to locate missing values in a data set. To apply a conditional formatting rule to highlight empty cells, follow these steps:

  1. Select the range that contains empty cells you want to highlight (C5:J16 in this case).
  2. On the Home tab of the ribbon, click Conditional Formatting, then New Rule.
  3. In the list of options for rule type, select “Use a formula to determine which cells to format”.
  4. In the input area, add the following formula: =ISBLANK(C5)
  5. Click the Format button and configure the desired formatting.

The result should be a Conditional Formatting rule like this:

A conditional formatting rule to highlight blank cells - 1

When you use a formula to apply conditional formatting, the formula is evaluated relative to the active cell in the selection at the time the rule is created. So, in this case, the formula =ISBLANK(C5) is evaluated for each cell in C5:J16. Because C5 is entered as a relative address, the address will be updated each time the formula is applied, and ISBLANK() is run on each cell in the range. The TRUE or FALSE result for each cell is what triggers the rule.

Empty vs. blank

=LEN(C5)=0

The LEN function returns the length of a text string as a number. A cell that contains an empty string ("") will have a length of zero, so the formula will return TRUE for cells that are truly empty and cells that contain an empty string ("") returned by a formula.

Not blank

To conditionally format cells that are not blank, you can use a formula like this:

=NOT(ISBLANK(A1))

The NOT function reverses the logic.

Explanation

In this example, the goal is to highlight the 5 bottom values in B4:G11 where the number 5 is a variable set in cell F2.

This formula uses two named ranges: data (B4:G11) and input (F2). These are for readability and convenience only. If you don’t want to use named ranges, make sure you use absolute references for both of these ranges in the formula.

This formula is based on the SMALL function , which returns the nth smallest value from a range or array of values. The range appears as the first argument in SMALL, and the value for “n” appears as the second:

SMALL(data,input)

In the example, the input value (F2) is 5, so SMALL will return the 5th smallest value in the data, which is 9. The formula then compares each value in the data range with 9, using the less than or equal to operator:

=B4<=SMALL(data,input)
=B4<=9

Any cell with a value less than or equal to 9 triggers the rule, and the conditional formatting is applied.