Fix Nested IF and IFS Logic When WPS Spreadsheets Compares Text to Numbers
Question details
The user needs to correct a nested IF or IFS formula in which a text value such as "TM" is evaluated by a numeric comparison and returns the wrong result branch.

- Product
- WPS Spreadsheets
- Device & OS
- not provided
- Scenario
- The user is building or repairing a conditional formula that must distinguish a specific text value from numeric thresholds using the same cell reference.
- Observed behavior
- Because text is treated as greater than all numbers, a condition like D6>0 or D6>1 evaluates as TRUE for "TM", so the formula chooses the numeric branch instead of the text match.
Open the WPS Spreadsheets workbook and select the cell that contains the IFS or nested IF formula. Identify the exact text condition and the numeric comparison that is currently evaluating before it.
Reorder IFS Conditions to Test the Exact Text Value First
Use this when the formula must distinguish a text item such as "TM" from numeric thresholds, and a numeric comparison is currently capturing the text value.
In WPS Spreadsheets and Microsoft Excel, text values are considered greater than all numbers. Because of this, a condition such as D6>0 returns TRUE for "TM" and can select the wrong IFS or nested IF branch.
Click the cell containing the IFS or nested IF formula, such as D7, and open the Formula Bar.
Change =IFS(D6>0,B7*$D$6,D6="TM",5*6) to =IFS(D6="TM",5*6,D6>0,B7*$D$6) so the exact text test is evaluated first.
Use =IFERROR(IFS(D6="TM",5*6,D6>0,B7*$D$6),0) to return 0 instead of #N/A when no condition is met.
Press Enter, then use the fill handle to copy the formula across the range. Confirm that text cells return the text branch and numeric cells return the numeric calculation.

Guard Numeric Comparisons with ISNUMBER
Use this when a worksheet contains mixed text and number entries and you do not want the result to depend only on the order of IFS conditions.
Fix IFS Text vs. Number Comparison in WPS Spreadsheets
Open your workbook in WPS Spreadsheets, reorder the IFS or nested IF logic so exact text conditions run before numeric comparisons, and use IFERROR or ISNUMBER to handle unmatched and mixed-type cells.
- 1. Open your workbook: Launch WPS Office, open the workbook in WPS Spreadsheets, and click the cell containing the IFS or nested IF formula.
- 2. Move the exact text test first: In the Formula Bar, place D6="TM" before any D6>0 or D6>1 comparison, as in =IFERROR(IFS(D6="TM",5*6,D6>0,B7*$D$6),0).
- 3. Test mixed inputs: Press Enter, then enter a number, text, and blank in the referenced cell to confirm the intended branch appears for each input type.
- 4. Save in Excel format: Click Menu > Save As and choose .xlsx to keep the file compatible with Microsoft Excel.

Frequently Asked Questions
Why does my IFS formula return the numeric result when D6 contains "TM"?
In WPS Spreadsheets and Excel, text is ranked greater than all numbers, so D6>0 or D6>1 returns TRUE for "TM". Put D6="TM" before the numeric comparisons or wrap the numeric branch with ISNUMBER.
What is the correct order for IFS conditions that mix text and numbers?
Place exact text matches first, then numeric comparisons, then a default or IFERROR fallback. For example: =IFERROR(IFS(D6="TM",5*6,D6>0,B7*$D$6),0).
Can I use the reordered formula in Microsoft Excel after editing in WPS Spreadsheets?
Yes. WPS Spreadsheets saves to .xlsx and uses Excel-compatible formula syntax, so the fixed IFS or nested IF formula works in both applications.
How do I avoid #N/A when no IFS condition is met?
Wrap the IFS function with IFERROR, for example =IFERROR(IFS(D6="TM",5*6,D6>0,B7*$D$6),0), or add a final TRUE condition to provide a default value.
Do AND conditions inside IF cause the same text comparison issue?
Yes. Any logical expression such as AND(D6>0,...) can return TRUE for text because text is considered greater than numbers. Isolate text checks first or use ISNUMBER to test numeric cells.




