IF Number Is Between Two Numbers Excel

“if number is between two numbers excel” comes up constantly, so this page leads with the exact answer, and only then explains the detail. Everything works in Excel on Windows and Mac and maps almost one-to-one to Google Sheets. Copy the answer above and get back to work, or read on to turn a one-off fix into something you never have to look up again.

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. If there is any chance you will reuse this, drop it into a small template tab right now: a labelled input area on the left and the formula beside it, checked once against the tool above. Next time the same question comes up, the answer is a single paste away instead of a rebuild from memory.

In Google Sheets

Everything above works in Google Sheets too. Excel and Sheets share the formula syntax used here; only the surrounding menus are arranged differently. That portability is deliberate — learn it once and it follows you between the two tools and across Windows and Mac. 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. If you take one thing from this page on “if number is between two numbers excel”, make it the habit rather than the keystrokes: set the problem up with labelled inputs, reference those cells, and let Excel do the recomputing. Bookmark the page for the syntax, but do the example once in a blank sheet and check it against the tool above — five minutes of hands-on practice fixes the method in memory far better than re-reading, and it surfaces the small snags while they are still harmless. After that the technique is genuinely yours: faster than searching for it again, and reliable enough to drop into work that other people depend on.

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.