To check whether a number falls between two values in Excel, use the AND function inside an IF: =IF(AND(A1>=10,A1<=20),"In range","Out of range"). This returns one result when the value is greater than or equal to the lower bound and less than or equal to the upper bound, and another result otherwise. No add-ins or special setup are required — any modern version of Excel (desktop, web, or mobile) supports it.
What You'll Need
- A spreadsheet with a column of numbers to test.
- Two boundary values (a lower limit and an upper limit).
- Basic familiarity with cell references such as A2 or B2.
Step-by-Step
- Open your workbook and click the cell where you want the result to appear — for example, B2 next to the first number in A2.
- Type the formula, replacing the cell reference and limits with your own: =IF(AND(A2>=10,A2<=20),"In range","Out of range"). The AND part tests both conditions at once; IF returns the first text if both are true and the second text if not.
- Press Enter. The cell shows either "In range" or "Out of range" depending on the value in A2.
- Drag the fill handle (the small square at the bottom-right of the cell) down to copy the formula to the rows below. Relative references adjust automatically, so A2 becomes A3, A4, and so on.
- If you want the result to be a number or blank instead of text, swap the quoted strings. For example, =IF(AND(A2>=10,A2<=20),1,0) returns 1 for true and 0 for false, which is handy for counting or summing.
- To test exclusive bounds (strictly between, not including the limits), use > and < instead of >= and <=: =IF(AND(A2>10,A2<20),"Yes","No").
- If your lower and upper limits live in their own cells (say D1 and D2), reference them instead of hard-coding: =IF(AND(A2>=$D$1,A2<=$D$2),"In range","Out of range"). The dollar signs lock the references so they do not shift when you copy the formula down.
Common Mistakes
- Reversing the bounds. If the lower limit is larger than the upper limit, AND can never be true. Double-check that the first comparison uses the smaller number.
- Forgetting the AND. Writing =IF(A2>=10,A2<=20,...) tests only the first condition; the second becomes the value-if-false result, which is not what you want.
- Mixing text and numbers. If your values are stored as text (often left-aligned), comparisons may behave unexpectedly. Convert them to numbers first.
- Missing quotes around text results. Text outputs such as "In range" must be in double quotes; numbers and cell references must not be.
- Unlocked references when copying. If the limits are in fixed cells, use $D$1 style absolute references, or the bounds will drift as you fill down.
Tips
- Use named ranges for your limits (Formulas > Define Name) to make formulas easier to read, such as =IF(AND(A2>=Low,A2<=High),"Yes","No").
- For a cleaner look, return an empty string "" instead of text when the value is out of range.
- Combine with conditional formatting to highlight in-range rows automatically.
- If you need three or more bands (low, medium, high), nest IFs or use IFS where available.
Troubleshooting
- Formula shows as text. The cell may be formatted as Text. Change the format to General, then re-enter the formula (pressing F2 and Enter also re-evaluates it).
- #VALUE! error. One of the compared cells contains text that cannot be treated as a number. Clean the data or wrap the reference in VALUE().
- #NAME? error. Check for a misspelled function name or an unquoted text string.
- Wrong results after copying. Inspect the references — you likely need absolute references ($) for the limit cells.
- Nothing changes when the source value changes. Calculation may be set to Manual. Go to Formulas > Calculation Options and choose Automatic.
Frequently Asked Questions
Can I use IF between two values with dates?
Yes. Dates are stored as numbers, so =IF(AND(A2>=DATE(2024,1,1),A2<=DATE(2024,12,31)),"Yes","No") works, or reference date cells directly.
What is the difference between >= and >?
>= includes the boundary value; > excludes it. Use >= and <= when the limits themselves should count as in range.
Can I check if a value is between two values in another sheet?
Yes. Reference the other sheet with its name, for example =IF(AND(A2>=Sheet2!$A$1,A2<=Sheet2!$A$2),"Yes","No").
Why does my formula return FALSE instead of my text?
You probably left out the value-if-false argument. IF needs three parts: the test, the true result, and the false result.
Can I use this with text values instead of numbers?
Comparisons like >= work on text alphabetically, but they are rarely useful. For text, use exact matches or functions such as COUNTIF with wildcards.