Flag Out-of-Range Values

Excel Formulas › Auditing & Error-Proofing

All versionsIF

Catch data-entry errors by flagging any value outside an allowed band — a percentage over 100%, a negative quantity, an impossible date. One IF with an OR turns a column into a validation report.


Quick formula: flag a value outside min/max:
=IF(OR(A2<min, A2>max), "Out of range", "OK")
True if the value is below the minimum or above the maximum; otherwise it passes.

Functions used (tap for the full reference guide):

The example

Allowed 0–100; 142 fails.

AB
1ValueCheck
285OK
3142Out of range

The formula

The formula:

=IF(OR(A2<min, A2>max), "Out of range", "OK") // below min or above max

How it works

How it works:

  1. OR(value < min, value > max) is TRUE when the value breaks either bound.
  2. Wrap in IF to return a flag — or MEDIAN(value, min, max)=value for a clamp-style test.
  3. Add NOT(ISNUMBER(A2)) to also catch non-numeric entries.
  4. Pair with conditional formatting to highlight the offending cells.

MEDIAN is a slick range test. MEDIAN(value, min, max) = value is TRUE only when the value sits within [min, max] — because MEDIAN returns the middle of the three, it equals the value only when the value isn’t the smallest or largest. It’s a compact alternative to the OR test and doubles as the clamp formula when you want to correct rather than flag.

Try it: interactive demo

Live demo

Value with allowed min/max.

Check:

Variations

MEDIAN test

In range?:

=MEDIAN(A2,min,max)=A2

Catch non-numbers

Also flag text:

=IF(OR(NOT(ISNUMBER(A2)),A2<min,A2>max),"Bad","OK")

Count out of range

How many:

=SUMPRODUCT(--((range<min)+(range>max)>0))

Pitfalls & errors

Inclusive vs exclusive. Decide whether the boundary values pass — use </<= deliberately.

Non-numbers. Text passes a > test oddly — add an ISNUMBER guard.

Blanks. An empty cell may count as 0 — handle it explicitly if needed.

Practice workbook

📊
Download the free Flag Out-of-Range Values practice workbook
An out-of-range sheet with the MEDIAN, non-number, and count variants, plus 4 challenges with answers. No sign-up required.

Frequently asked questions

How do I flag out-of-range values in Excel?
Use =IF(OR(A2max), "Out of range", "OK"), or test within range with =MEDIAN(A2,min,max)=A2.
How do I also catch text entries?
Add an ISNUMBER guard: =IF(OR(NOT(ISNUMBER(A2)),A2max),"Bad","OK").
How do I count how many values are out of range?
Use =SUMPRODUCT(--((rangemax)>0)).

Stop fighting formulas. Learn them in a day.

This recipe is one of hundreds of real-world formulas we teach. Our Excel Formulas & Functions class covers lookups, logic, text, and dynamic arrays hands-on — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class

Related formulas: Cap value between · Restrict to whole numbers · Data validation dropdown

Function references: IFOR