IF Number Is Between Two Numbers Excel

If you just need to if number is between two numbers excel and move on, the boxed answer at the top is all you need. The rest of this page is for when you want to understand why it works in Excel, adapt it to a trickier version, or make it robust enough to hand to a colleague. We keep the opening short on purpose — the depth is here when you want it, not in your way when you don’t.

Exact answer

In Excel: =IF(AND(A1>=10,A1<=20),"Yes","No") — AND() is required; a chained comparison like =IF(10<=A1<=20,"Yes","No") looks reasonable but is wrong, because Excel evaluates left to right: 10<=A1 resolves to TRUE or FALSE first, and Excel ranks any logical value as greater than every number, so that TRUE or FALSE compared to <=20 is always FALSE — the formula silently returns "No" for every value of A1, with no error to flag the mistake.

On this page7
▤Annotated stepsExcel
1

Decide the two boundary values, e.g. 10 (low) and 20 (high).

2

Write =IF(AND(A1>=10,A1<=20),"Yes","No") — never chain the comparisons directly as 10<=A1<=20.

3

Swap >= /<= for > / < if the boundaries themselves should NOT count as "inside" the range.

4

For a compact TRUE/FALSE flag instead of text, =MEDIAN(10,A1,20)=A1 returns TRUE exactly when A1 sits between 10 and 20 inclusive, since the median of the two boundaries and A1 equals A1 itself only in that case.

5

Fill the formula down the column once it is confirmed correct for one row.

=IF(AND(A1>=10,A1<=20),"Yes","No")
Ctrl+CthenCtrl+Shift+V⌘+Cthen⌘+Ctrl+VPaste values · WindowsMac

What this does

Checking whether a number falls inside a range needs two separate comparisons joined by AND(), because Excel formulas do not support the algebra shorthand "10 ≤ x ≤ 20" the way a math textbook does. Typing that shorthand directly as =IF(10<=A1<=20,...) is syntactically legal — it just means something completely different: Excel evaluates the leftmost comparison (10<=A1) first, producing a TRUE or FALSE, and then compares THAT boolean against 20. Because Excel ranks every logical value above every number for comparison purposes, a boolean is never <=20 — so the second comparison is always FALSE, and the whole formula always returns the FALSE branch, for every possible A1. It never errors, so this mistake ships silently into a live spreadsheet. The same idea underpins a lot of everyday Excel work, so the few minutes spent getting it right here pay back across every sheet you build afterwards. Treat it as a pattern, not a one-off, and it stops being something you look up and starts being something you reach for. Treat “if number is between two numbers excel” as a small repeatable workflow rather than a one-off click you hope to remember next time. Use a small test block before the live file, so any surprise in the affected cells shows up while it is still harmless. When a formula is involved, keep the inputs labelled beside it, reference cells instead of typing values, and apply number formatting only after the result checks out. That turns a workflow that saves repeating the same clicks every week into a method you can reuse, explain, and defend when the workbook leaves your screen.

A worked example

A2 holds 15. =IF(AND(A2>=10,A2<=20),"Yes","No") correctly returns "Yes." The chained version =IF(10<=A2<=20,"Yes","No") returns "No" instead — even though 15 clearly sits between 10 and 20 — because 10<=A2 evaluates to TRUE first, and TRUE<=20 is FALSE (Excel treats TRUE as ranked above any number in a comparison), so the outer IF always takes the FALSE branch regardless of what A2 actually contains. "Between two numbers" reads like something a formula should handle in one comparison, and the syntactically-valid-but-wrong chained version is exactly the kind of mistake that passes a quick glance and then quietly poisons every downstream calculation that depends on it. Check the referenced cells, argument order and result type in your workbook. Start with the worked example before changing an input, then compare the changed result with the calculation you expected. An error value or a result of a different type is a reason to inspect the inputs and arguments.

In Google Sheets

The standard worksheet functions used by this example are listed in Google Sheets. Check the cell references, argument separators and input types in the target spreadsheet, then compare the worked result. This formula-availability check does not establish identical menus, keyboard shortcuts or workbook features, and it is not a product execution test. The aim was to get you unstuck fast and leave you a little more capable than a copy-paste would. The answer is at the top and the detail above shows why it holds — so the next time a colleague asks, you can answer without reaching for search. For “if number is between two numbers excel”, keep the input cells and the result visible while you check the formula in Excel. Follow the worked example and change one input at a time. The steps explain the workbook calculation; this page does not run a live calculator for that task.

Common mistakes

  • Writing =IF(10<=A1<=20,...) expecting it to work like math notation — it runs without error but always evaluates to the FALSE branch, because the intermediate boolean result is never <=20 under Excel's comparison rules.
  • Using OR() instead of AND() — OR(A1>=10,A1<=20) is TRUE for almost every number (anything above 10 OR below 20 covers nearly the whole number line), the opposite of a "between" test.
  • Forgetting to decide whether the boundaries count as "inside" the range — >= and <= include them; > and < exclude them, and the two give different answers when A1 is exactly 10 or 20.
  • Testing a blank or text cell against numeric boundaries and trusting the result without checking — a blank cell compares as 0 (correctly returning "No" for 10-20), but text can produce a misleading comparison instead of a clear error.

Frequently asked questions

What is the Excel formula to check if a number is between two other numbers?

=IF(AND(A1>=10,A1<=20),"Yes","No") — use AND() with two separate comparisons, never a chained =IF(10<=A1<=20,...) expression.

Why does =IF(10<=A1<=20,...) always return the wrong answer?

Excel evaluates 10<=A1 first into a TRUE/FALSE, then compares that boolean to 20. A logical value always ranks above any number in Excel, so it is never <=20 — the formula always takes the FALSE branch no matter what A1 is.

Does this work the same way in Google Sheets?

Yes — =IF(AND(A1>=10,A1<=20),"Yes","No") returns identical results in Sheets, and the chained =IF(10<=A1<=20,...) mistake fails the same way there too, since Sheets ranks logical values above numbers in comparisons the same way Excel does.

Other ways people ask this

People reach this page typing “excel is between two numbers”, “excel if is number” and “excel if a number is between two numbers”, among other phrasings; whichever wording you used, the fix above is the one you want.

Why do people search for this in so many different ways?

Because the same task has many names. “excel is between two numbers”, “excel if is number”, “excel if a number is between two numbers” all point at the one operation explained on this page, which is why they all lead here.