Formula Errors

Use Excel IF and AND to Check a Number Range

Muhammad TalhaMuhammad Talha Nov 20, 2026 869 views

Question details

The user needs a valid formula that tests whether a number falls between two limits and returns a result.

Check a Number Range with Excel IF and AND
Product
Microsoft Excel
Device & OS
not provided
Scenario
Check whether the value in AB4 is greater than 1 and less than 1.25, then return 17.25.
Observed behavior
The attempted formula uses invalid comparison syntax.
Before you start

Identify the cell containing the number and decide whether either boundary should be included. The examples below use AB4 as the input cell.

Solution 1Recommended

Use AND Inside IF to Test Both Range Limits

Use this formula when a value must satisfy both the lower and upper limit.

1
Select the result cell

In Excel, click the cell where you want the result to appear.

2
Enter the formula

Type =IF(AND(AB4>1,AB4<1.25),17.25,"") and press Enter. Replace AB4 and the limits as needed.

3
Check the result

Enter a value such as 1.1 in AB4. The formula returns the number 17.25; values outside the range, including 1 and 1.25, return a blank.

Use AND Inside IF to Test Both Range Limits
Include the endpoints if needed: Use >= and <= instead of > and < to include 1 and 1.25. The unquoted 17.25 is a number; use "17.25" if you need a text result.
Use WPS Spreadsheets

Check Number Ranges in WPS Spreadsheets

Use IF and AND in WPS Spreadsheets to test a value against two limits and return a result in an Excel-compatible workbook.

  1. 1. Open your workbook: Open WPS Spreadsheets and select Open to choose your workbook.
  2. 2. Select a result cell: Click the cell where you want the range-check result.
  3. 3. Enter the formula: Type =IF(AND(AB4>1,AB4<1.25),17.25,"") and press Enter.
  4. 4. Test and save: Enter a test number in AB4, check the result, and select Save.
Test both range limits in a single formulaOpen and edit Microsoft Excel XLSX and XLS filesUse a familiar spreadsheet interfaceWork with spreadsheets for free
microsoft office alternative - wps office

Frequently Asked Questions

How do I include the boundary values in the range?

In the formula cell, use =IF(AND(AB4>=1,AB4<=1.25),17.25,""). The >= and <= operators include both endpoints.

How can I return different results for multiple ranges?

In the result cell, nest another IF function or use IFS where supported. Give each range its own AND test and corresponding result, and define the boundaries to avoid overlaps or gaps.

Why does Excel reject the formula even though the syntax looks correct?

Check the formula bar for missing parentheses or quotation marks. Depending on your regional settings, you may also need semicolons instead of commas between arguments and a different decimal separator.

What happens if AB4 is exactly 1 or 1.25?

With >1 and <1.25, neither endpoint meets the test, so the formula returns a blank. Change the relevant operator to >= or <= to include an endpoint.