Conditional Logic

How to Check If a Value Is Between Two Numbers in Excel

Learn how to check whether a value falls between two numbers in Excel using AND with IF, with inclusive and exclusive limits, dates and counting matches.

On this page
  1. Inclusive and exclusive limits
  2. Put the limits in cells
  3. Dates work the same way
  4. Count or sum values between two numbers
  5. Bands that set a rate or a price
  6. Numbers stored as text

Excel doesn’t have a BETWEEN function. To test whether a number falls between two limits, put two comparisons inside AND, then put AND inside IF:

=IF(AND(A2>=10, A2<=20), "Yes", "No")

This returns Yes when A2 is 10, 20 or any value in between. Both ends are included, which is called an inclusive range. If IF itself is new to you, start with how to use if function in excel.

Inclusive and exclusive limits

The operators control whether each end counts:

  • Inclusive (both ends included): >= and <=.
  • Exclusive (both ends left out): > and <.
  • Low end included, high end left out: >= and <.

For example, an order band of 100 up to but not including 500 is:

=IF(AND(B2>=100, B2<500), "Mid tier", "Other")

An order of exactly 500 falls outside this band and returns “Other”.

Put the limits in cells

Typing the limits into the formula works, but then every formula has to change when a limit changes. Put the low limit in D1 and the high limit in E1, and use absolute references:

=IF(AND(A2>=$D$1, A2<=$E$1), "In range", "Out of range")

Now you can change the limits in D1 and E1, and every row updates. The dollar signs keep the references fixed as you copy the formula down. How to lock cell reference in excel explains them in more detail.

Dates work the same way

Excel stores dates as numbers, so the same comparisons work on dates. To check whether a date falls in the first quarter of 2026:

=IF(AND(B2>=DATE(2026,1,1), B2<=DATE(2026,3,31)), "Q1", "Other")

The DATE function builds each boundary date from its year, month and day. The approach is covered further in excel date function from year month day.

Count or sum values between two numbers

If you want a count rather than a label on each row, COUNTIFS takes two criteria on the same range:

=COUNTIFS(A2:A100, ">=10", A2:A100, "<=20")

Each criterion is written as text, with the operator in front. For the pattern in more depth, see countifs with two conditions in excel.

Bands that set a rate or a price

When the value sets a rate, such as a commission or a shipping fee, there may be several bands rather than one range. Chaining many AND tests inside IF gets long quickly. For those cases, IFS or a lookup table is usually easier to maintain. The pay-by-band case is covered in tiered commission formula in excel.

Numbers stored as text

If a value looks like a number but Excel reads it as text, the comparisons can give wrong results. A text number is usually aligned to the left of its cell, and it may carry a small green triangle in the corner. Convert the values to real numbers first. How to convert text to number in excel covers the steps.

The complete guide to conditional logic

How to Use the IF Function in Excel
Read the guide

Keep exploring

Guides from other topics

All topics →