In other words, to count values that are “out of range”.

You might at first think to use theCOUNTIFS functionwith two criteria.

Instead, we need OR logic.

Conditional formatting to highlight out of range values

When added together these two results correctly handle the required logic: less than I5 OR greater than J5.

This is an example of usingboolean algebrawith addition (+), which creates OR logic.

The formula used to highlight the out-of-range values above is:

More detailshere.

Conditional formatting to highlight out of range values

Conditional formatting to highlight out of range values

Conditional formatting to highlight out of range values

Conditional formatting to highlight out of range values

Excel formula: Count cells between two numbers

Excel formula: Count cells between dates

Excel formula: Highlight values not between X and Y

Excel formula: Count matches between two columns

Excel COUNTIF function

Excel SUMPRODUCT function

Conditional formatting to highlight out of range values