Function Problems

How to Write an Excel Formula to Match Values and Numeric Ranges

Steve KSteve K Nov 10, 2026 868 views

Question details

The user needs an Excel formula to check a condition in one column and verify if a related number in another column falls within specific ranges, returning custom results based on the match.

Excel Formula for Matching a Value and Numeric Range
Product
Excel / WPS Spreadsheet
Device & OS
not provided
Scenario
Categorizing or returning specific labels based on a combination of exact text matches and numeric range conditions.
Observed behavior
Requires an automated way to output specific results (like 'Y' or 'Z') when both conditions (text match and numeric range) are met.
Before you start

Determine your exact criteria for both the text match and the numeric boundaries. Note that the IFS function is available in newer versions of Excel and WPS Office; if you are using an older version, you will need to use nested IF functions.

Solution 1Recommended

Use the IFS and AND Functions (Modern Approach)

The most efficient way to handle multiple conditions and ranges in newer spreadsheet software.

The IFS function allows you to test multiple conditions without writing complex nested statements. By combining it with the AND function, you can evaluate both text matches and numeric ranges simultaneously.

1
Select the target cell

Click on the cell where you want the final categorized result to appear.

2
Enter the IFS formula

Type the formula: =IFS(AND(A2="X", B2>=10, B2<=20), "Y", AND(A2="X", B2>21, B2<=30), "Z", TRUE, ""). Replace "X", "Y", "Z", and the numbers with your actual data criteria.

3
Apply to the dataset

Press Enter to apply the formula, then click and drag the fill handle at the bottom right of the cell to copy the formula down to other rows.

Use the IFS and AND Functions (Modern Approach)
Understanding the formula: The TRUE argument at the end acts as a catch-all, returning a blank string ("") if none of the previous conditions are met. This prevents unsightly #N/A errors.
Solve Formula Problems Easily

Use WPS Spreadsheet for Advanced Formula Handling

WPS Spreadsheet fully supports advanced logical functions like IFS, IF, and AND, making it incredibly easy to manage complex data categorization. It offers a familiar interface and function wizard, ensuring your formulas work seamlessly without syntax errors.

  1. 1. Open your workbook: Launch WPS Spreadsheet and open the document containing your data.
  2. 2. Open the function wizard: Click on the 'Formulas' tab in the top ribbon and select 'Insert Function' to open the formula dialog box.
  3. 3. Configure the IFS function: Search for 'IFS', select it, and input your logical tests (using the AND function for ranges) and return values directly into the input fields.
  4. 4. Insert the formula: Click 'OK' to insert the error-free formula into your cell, then drag it down to apply to remaining rows.
Fully compatible with Microsoft Excel formulas (.xlsx format).Built-in function wizard helps build complex IFS and nested IF statements visually.Free and lightweight alternative to heavy spreadsheet software.Cross-platform support for Windows, Mac, Linux, iOS, and Android.
microsoft office alternative - wps office

Frequently Asked Questions

Why is my IFS formula returning an #N/A error?

An #N/A error in an IFS formula means that none of the conditions evaluated to TRUE, and no default catch-all condition was provided. To fix this, add TRUE as the final logical test, followed by your desired default value, such as TRUE, "Not Found".

Can I use the OR function instead of AND for checking ranges?

The AND function is required when you want a number to fall strictly between two boundary values (e.g., greater than 10 AND less than 20). If you use OR, the condition returns true if the number meets either requirement, which breaks the logic for an inclusive numeric range.

How many nested IF conditions can I use?

In modern versions of Excel and WPS Spreadsheet, you can nest up to 64 IF functions. However, if you find yourself nesting more than 4 or 5 conditions, it is highly recommended to use the IFS function or create a VLOOKUP/XLOOKUP reference table for better readability.

Does this formula work if my numeric range has decimals?

Yes, logical operators like >= and <= evaluate decimal numbers correctly. Just ensure your formula criteria match the precision you need (e.g., using B2>=10.5).