How to Use Excel IF Formula for Multiple Positive and Negative Ranges
Question details
The user needs a formula to evaluate a number against multiple positive and negative boundaries centered around zero, outputting 1, 2, or 3 based on the range it falls into.
- Product
- Excel
- Device & OS
- not provided
- Scenario
- Categorizing numerical data into distinct bands (e.g., inner threshold, middle threshold, and outer threshold) for both positive and negative values.
- Observed behavior
- A specific formula is required to return 1 for values between -0.10 and 0.10, 2 for intermediate values, and 3 for extreme values outside the -0.25 to 0.25 range.
Ensure the cell containing the value you want to test (e.g., A1) is formatted as a Number and does not contain any hidden text characters.
Use a Nested IF and OR Formula
Combine the IF and OR functions to test both positive and negative boundaries simultaneously in a single formula.
By nesting IF functions alongside the OR function, you can evaluate whether a number falls outside specific thresholds in either the positive or negative direction. The formula evaluates the most extreme conditions first, filtering data down to the inner ranges.
Click on the empty cell where you want the categorized result (1, 2, or 3) to appear.
Type the following formula: =IF(OR(A1<-0.25,A1>0.25),3,IF(OR(A1<-0.1,A1>0.1),2,1)). Replace 'A1' with your actual data cell reference.
Press the Enter key. The cell will now display the assigned category number.
Click and drag the small square at the bottom-right corner of the cell to apply the formula to the rest of your data set.
Categorize Data with Formulas in WPS Spreadsheet
WPS Spreadsheet fully supports advanced logical functions like IF and OR. You can easily build complex nested formulas to categorize your numerical data, utilizing the built-in formula builder to prevent syntax errors.
- 1. Open your data file: Launch WPS Spreadsheet and open the workbook containing your numerical data.
- 2. Insert the logical formula: Select a blank cell, type '=IF(', and follow the on-screen formula helper to input your OR conditions.
- 3. Calculate and drag: Press Enter to generate the result, then drag the fill handle to apply it across your dataset.

Frequently Asked Questions
Can I use the IFS function instead of nested IFs?
Yes, if you are using a newer version of Excel or WPS Spreadsheet, you can simplify this with the IFS function. The equivalent formula is =IFS(OR(A1<-0.25,A1>0.25),3, OR(A1<-0.1,A1>0.1),2, TRUE, 1).
Why is my formula returning an error?
The most common issue with nested IF and OR formulas is missing parentheses. Ensure that each OR function is properly closed with a parenthesis before adding the comma for the IF function's true/false arguments.
How do I apply this formula to percentages instead of decimals?
If your data is formatted as percentages (like 25%), the software still treats them as decimals (0.25) under the hood. You can use the exact same formula provided, and it will work perfectly with percentage data.
Can I return text labels instead of numbers?
Yes. To output text, replace the numbers (1, 2, 3) in the formula with your desired text enclosed in quotation marks. For example: =IF(OR(A1<-0.25,A1>0.25),"Extreme", IF(OR(A1<-0.1,A1>0.1),"Moderate","Neutral")).




