To check if a number is between two values in Excel, you must combine the IF function with the AND function. Because the standard IF function only supports one logical test at a time, the AND function acts as a wrapper that allows you to test multiple conditions—specifically, that the number is greater than or equal to the minimum value AND less than or equal to the maximum value. The basic formula structure is: =IF(AND(cell>=min, cell<=max), "Yes", "No").

What You'll Need

  • A computer with Microsoft Excel installed (works in all versions, including Excel 365, 2021, 2019, and Excel for the Web).
  • A dataset containing the numbers you wish to evaluate.
  • A defined minimum and maximum threshold for your range.

Step-by-Step

  1. Organize Your Data: Place the number you want to test in a specific cell (for example, cell A2). For better flexibility, place your minimum boundary in one cell (e.g., D2) and your maximum boundary in another (e.g., E2). This allows you to change the range later without editing every formula.
  2. Start the IF Function: Click on the cell where you want the result to appear (e.g., B2) and type =IF(. The IF function requires three parts: the logical test, the value if true, and the value if false.
  3. Insert the AND Function: Inside the parentheses of the IF function, type AND(. This creates a nested condition. The AND function will return TRUE only if every single argument inside it is true.
  4. Define the Lower Bound: While still inside the AND parentheses, click the cell containing the number you are testing (A2), type the greater-than-or-equal-to symbol >=, and then click the cell containing your minimum value (D2). It should look like A2>=D2.
  5. Define the Upper Bound: Type a comma to separate the arguments within the AND function. Then, click the number being tested again (A2), type the less-than-or-equal-to symbol <=, and click the cell containing your maximum value (E2). Your formula now looks like =IF(AND(A2>=D2, A2<=E2),.
  6. Close the AND Function: Type a closing parenthesis ). This tells Excel that the logical test is complete.
  7. Set the "True" Result: Type a comma, then enter the value you want to see if the number is indeed between the two values. If it is text, wrap it in double quotes, such as "Within Range".
  8. Set the "False" Result: Type another comma, then enter the value you want to see if the number falls outside the range, such as "Out of Range".
  9. Finalize and Execute: Type the final closing parenthesis ) and press Enter. The complete formula should look like: =IF(AND(A2>=D2, A2<=E2), "Within Range", "Out of Range").
  10. Apply to Other Rows: Click the small green square (fill handle) at the bottom-right corner of cell B2 and drag it down to apply the formula to the rest of your column.

Common Mistakes

One of the most frequent errors is attempting to write the formula as =IF(D2<=A2<=E2, "Yes", "No"). While this looks like a standard mathematical expression, Excel cannot process "between" logic this way. Excel evaluates the first part (D2<=A2) as either TRUE or FALSE. It then compares that TRUE/FALSE result to the second number (E2), which leads to incorrect or unpredictable results. You must always use the AND function to separate the two comparisons.

Another common mistake is forgetting the double quotes around text values. If you type =IF(AND(A2>=10, A2<=20), Yes, No), Excel will look for a named range called "Yes" or "No" instead of treating them as words. This results in a #NAME? error. Always use "Yes" and "No".

Users also frequently confuse the > (greater than) and < (less than) symbols. A helpful tip is to remember that the "mouth" of the symbol always opens toward the larger value. If you want to check if a number is at least 10, the number must be on the open side: A2 >= 10.

Tips

Using Absolute References: If your minimum and maximum values are in fixed cells (like D2 and E2) and you are dragging the formula down a long list, use absolute references (dollar signs). Change D2 to $D$2 and E2 to $E$2. This prevents Excel from shifting the reference cells downward as you copy the formula, ensuring every row is compared against the same two boundaries.

Handling Inclusive vs. Exclusive Ranges: Decide if the boundary numbers themselves should count as being "between." If you use >= and <=, the range is inclusive (e.g., if the range is 10 to 20, both 10 and 20 are marked as "Within Range"). If you use > and <, the range is exclusive, and 10 and 20 would be marked as "Out of Range."

Adding a Third Condition: If you have more than two boundaries (for example, categorizing numbers as Low, Medium, or High), you can nest multiple IF statements. For example: =IF(A2<10, "Low", IF(AND(A2>=10, A2<=20), "Medium", "High")). This allows you to create tiered brackets for grading or pricing.

Troubleshooting

If your formula returns a #VALUE! error, check to ensure that the cells you are referencing actually contain numbers. If a number is formatted as text, Excel may struggle to perform the mathematical comparison. You can fix this by selecting the column, going to the Data tab, selecting Text to Columns, and clicking Finish to force Excel to re-evaluate the data types.

If the formula returns "Out of Range" for a number that clearly looks like it is inside the range, check for hidden decimals. A cell might display "10" due to rounding, but the actual value could be "9.9999," which would fail a >=10 test. Use the Increase Decimal button on the Home tab to verify the exact value of your data.

If you see a #NAME? error, double-check your spelling of the functions. Ensure you haven't typed ANDD or IFF. Also, verify that all text results are enclosed in double quotes.

If the formula is not updating when you change the boundary values, check your Calculation Options. Go to the Formulas tab > Calculation Options and ensure it is set to "Automatic." If it is set to "Manual," you must press F9 to refresh the results.

Frequently Asked Questions

Can I use this for dates instead of numbers?

Yes. Excel stores dates as serial numbers, so the AND and IF functions work perfectly for date ranges. Just ensure your boundary cells are also formatted as dates.

Is there a simpler way than using the AND function?

For basic "between" checks, the IF(AND()) method is the standard. However, if you are using a newer version of Excel, you can use the IFS function to handle multiple ranges more cleanly without nesting multiple IFs.

What happens if one of the cells is empty?

Excel typically treats an empty cell as 0. If your minimum boundary is 10 and the test cell is empty, it will be treated as 0 and return the "False" result. To avoid this, you can wrap your formula in an IF(ISBLANK(A2), "", ...) statement to keep the result cell empty if the input is missing.

Can I highlight cells that are between two values automatically?

Yes, using Conditional Formatting. Go to Home > Conditional Formatting > New Rule > Use a formula to determine which cells to format. Enter the =AND(A2>=D2, A2<=E2) part of the formula and choose a fill color. This will highlight the cells instead of writing "Yes" or "No" in a separate column.

Does this work for negative numbers?

Yes, it works exactly the same way. Just ensure your minimum value is the more negative number (e.g., -50) and your maximum is the less negative or positive number (e.g., -10).