How to Fix Excel IF Formula Returning FALSE When Comparing 120
Question details
The IF formula unexpectedly returns FALSE when checking if a cell equals the number 120, caused by a mismatch between numeric and text data types.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Writing an IF function to run a logical test comparing a cell's contents to a specific value (120).
- Observed behavior
- The formula evaluates to FALSE even when the cell visually contains the target number, because Excel is treating the reference cell as text while the formula is checking for a numeric value.
Check the data format of the cell you are comparing to see if the value '120' is stored as a standard numeric value or as a text string.
Use standard numeric comparison without quotation marks
Apply this solution when the target cell contains a true numeric value.
In Excel, numbers are recognized natively by the calculation engine. If the cell you are referencing contains a number, your formula should not contain quotation marks around that number.
Click on the empty cell where you want the result of your IF formula to appear.
Type the formula =IF(O2=120, "yes", "no") into the formula bar at the top of the screen.
Press the Enter key. Because 120 is entered without quotation marks, Excel will successfully match it against a numeric cell.

Use quotation marks for text string comparisons
Use this method if the number in the reference cell is formatted as text, or imported from an external database as a text string.
Write and Troubleshoot IF Formulas Easily with WPS Office
WPS Spreadsheet provides an intuitive formula builder and smart error checking tools. It automatically highlights numbers stored as text so you know exactly which IF formula syntax to use without second-guessing.
- 1. Open your workbook in WPS Spreadsheet: Launch WPS Office and open your spreadsheet document.
- 2. Check the cell format: Look at the target cell (e.g., O2). If there is a small green triangle in the top-left corner, it indicates the number is stored as text.
- 3. Enter your formula: Click your result cell and type =IF(O2=120,"yes","no") for numbers, or =IF(O2="120","yes","no") if it is formatted as text.
- 4. Press Enter to calculate: Hit Enter on your keyboard to instantly run the logical calculation.

Frequently Asked Questions
Why are quotation marks required for text but not numbers in Excel?
Excel relies on quotation marks to identify literal text strings. If you omit quotation marks around text, Excel interprets the word as a cell reference or a defined name, which usually results in a #NAME? error. Numbers are naturally recognized as values, so quotes aren't needed unless you specifically want them treated as text.
How do I convert a number stored as text back to a normal number?
Select the cells containing the text-formatted numbers (usually marked with a green triangle). Click the warning icon that appears next to the selection and choose 'Convert to Number' from the dropdown menu.
Can I make the IF function ignore whether a number is formatted as text?
Yes, you can use the VALUE function inside your IF formula to force a text number into a true numerical value. For example, the formula =IF(VALUE(O2)=120, "yes", "no") will evaluate correctly regardless of whether O2 is stored as text or a number.




