Correct a Nested IF Formula for Multiple Conditions in Excel 2013
Question details
Correct a nested IF formula that evaluates several conditions in cells E2 and F2.

- Product
- Microsoft Excel 2013
- Device & OS
- not provided
- Scenario
- The user needs one formula to handle blank cells, equal values, zeros, negative values, and positive values.
- Observed behavior
- The nested formula produces a syntax error instead of evaluating the conditions.
Check that E2 and F2 contain numbers or are blank, and choose a separate cell for the result. If your Excel regional settings use semicolons as argument separators, replace the formula's commas with semicolons.
Correct the Nested IF Formula with Combined Comparisons
Use this formula to check blanks and equal values first, then handle zero and negative values before dividing.
The order of the tests matters: equal values return 0 before either nonpositive-value test is applied. If E2 is nonpositive and the values are unequal, the formula returns 1; otherwise, if F2 is nonpositive, it returns -1.
In the Excel worksheet, click an empty cell such as G2.
In the formula bar, enter =IF(OR(E2="",F2=""),"",IF(E2-F2=0,0,IF(E2<=0,1,IF(F2<=0,-1,F2/E2)))) and press Enter.
Enter test values in E2 and F2. For example, 0 and 0 should return 0; 0 and 2 should return 1; 2 and 0 should return -1; and 4 and 2 should return 0.5. Leave either cell blank to check that the result is blank.

Use the Nested IF Formula in WPS Spreadsheets
Open your workbook in WPS Spreadsheets and enter the same nested IF formula to evaluate blanks, equal values, zeros, negatives, and positive values.
- 1. Open the workbook: In WPS Spreadsheets, select Open and choose your Excel workbook.
- 2. Select a result cell: Click an empty cell such as G2, next to the values in E2 and F2.
- 3. Enter the formula: In the formula bar, enter =IF(OR(E2="",F2=""),"",IF(E2-F2=0,0,IF(E2<=0,1,IF(F2<=0,-1,F2/E2)))) and press Enter.
- 4. Verify the results: Change the values in E2 and F2 to test blank, equal, zero, negative, and positive cases, then use File > Save to save the workbook.

Frequently Asked Questions
Why does the formula check for equal values first?
The equality test returns 0 whenever E2 and F2 have the same numeric value. Because it comes before the nonpositive tests, equal zeros and equal negative values also return 0.
What happens if E2 or F2 is blank?
The OR(E2="",F2="") test returns an empty string if either cell is blank, so the result cell appears blank.
Why do I still get a formula syntax error?
Check that all parentheses are included and that the formula begins with an equals sign. If your regional settings require semicolons, replace the commas between arguments with semicolons.
What does the formula return when both values are positive?
If the positive values are equal, it returns 0. Otherwise, it divides F2 by E2; for example, E2=4 and F2=2 returns 0.5.




