If your Excel IF formula is not working, first check its syntax, the cell references, and whether the values being compared are really the same type. In Microsoft Excel for Microsoft 365 on Windows, a basic IF formula follows =IF(logical_test,value_if_true,value_if_false); correcting one of those three parts resolves many problems.
How the IF function works
IF evaluates a condition and returns one result when the condition is true and another when it is false. The condition might compare two numbers, test whether a cell contains particular text, or check whether a value meets a threshold. Excel evaluates the test as TRUE or FALSE, then returns the corresponding result. The result can be text, a number, a cell reference, or another formula.
For example, with a student’s score in B2, and with B2 containing the number 82, enter:
=IF(B2>=70,"Pass","Fail")
This returns Pass because 82 is at least 70. The comparison operator is part of the condition: >= means greater than or equal to, while > means strictly greater than. Other common operators are <, <=, =, and <> for “not equal to.” A condition that uses the wrong operator can produce a valid result that is still not the result you intended.
Check the formula’s structure and punctuation
Excel expects an opening parenthesis after IF, a logical test, a comma, the true result, another comma, the false result, and a closing parenthesis. Text results need straight double quotation marks. A missing comma, unmatched parenthesis, or curly quotation mark copied from a document can make Excel reject the formula or interpret it differently.
For a concrete check, assume B2 contains 65 and you want a passing score to be 70 or higher. This complete formula returns Fail:
=IF(B2>=70,"Pass","Fail")
Excel’s function argument separator depends on its regional settings. If Excel displays an error when you type a formula with commas, your installation may require semicolons between arguments. In that case, use the separator Excel accepts, or check the system’s list-separator settings. The commas shown in this article are standard Excel syntax for installations that use commas.
Also confirm that the formula begins with an equals sign and that the IF name is followed by a parenthesis. IF is not case-sensitive, so if and IF work alike; punctuation and argument order are what matter.
Make sure the test matches your intention
A formula can be syntactically correct but test the wrong condition. Check the cell address, operator, and threshold against the rule you want to apply. For example, a score of exactly 70 passes under “70 or higher” but does not pass under “more than 70.” Check boundary values, not just values far above or below the cutoff.
When a rule requires multiple conditions, use AND or OR inside the logical test. AND returns TRUE only when every condition is true; OR returns TRUE when at least one condition is true. With a score in B2 and attendance percentage in C2, suppose the student must have a score of 70 or more and attendance of at least 80%. If B2 is 82 and C2 is 85%, this formula returns Eligible:
=IF(AND(B2>=70,C2>=80%),"Eligible","Not eligible")
For a rule where either condition is enough, replace AND with OR. Be careful with parentheses: the location of AND or OR changes which conditions Excel groups together. If a rule is difficult to read, write it in plain language first, then translate each requirement into a comparison.
Check whether the values are numbers, text, or dates
Numbers that look identical on screen may not be stored the same way. A cell can contain the number 100, or text consisting of the characters “100.” A comparison or calculation may behave differently when a value is stored as text. Imported data, pasted values, and cells with a leading apostrophe are common sources of this mismatch. A number format changes how a value looks; it does not necessarily convert text into a number.
Check a suspicious cell by selecting it and inspecting the formula bar. You can also test whether Excel treats a value as a number. With the value in B2, this formula returns TRUE if Excel recognizes it as numeric:
=ISNUMBER(B2)
If the result is FALSE even though B2 looks like a number, convert the source data appropriately. Depending on the situation, re-entering the value, using Text to Columns, or using a conversion function can help. Do not convert blindly if leading zeros are meaningful, as they often are in postal codes or ID numbers.
Dates need attention for the same reason: Excel comparisons work as expected when the entries are genuine date values, not date-looking text. With a real date in C2, this formula returns Current for a date on or after January 1, 2026:
=IF(C2>=DATE(2026,1,1),"Current","Expired")
A cell that displays a date but is stored as text may fail that test. Check the source and convert it before relying on the result.
Understand blanks and text comparisons
Blank-looking cells can contain a formula that returns an empty string, spaces, or other invisible characters. Those are not always equivalent to a truly empty cell. ISBLANK returns TRUE only when a cell is empty; it returns FALSE for a cell containing a formula, even if that formula displays nothing. If your test is “does this cell appear empty?”, consider whether the source might contain a formula or spaces.
With a possible entry in A2, this formula returns Missing if A2 is empty or contains a zero-length text value:
=IF(A2="","Missing","Entered")
Text comparisons also catch people out. Excel’s ordinary equality comparison for text is generally not case-sensitive, so a test for “yes” also matches “Yes.” Extra spaces, however, can make two entries look alike while comparing differently. TRIM can remove ordinary leading and trailing spaces from text, but it does not remove every kind of invisible character. When values come from a website or another system, inspect or clean the source as needed.
Look for references that changed or were copied incorrectly
If a formula works in one row but not another, inspect its references. A relative reference such as B2 changes when you copy the formula down; it becomes B3, B4, and so on. That is usually useful, but it can cause errors if the formula was meant to keep referring to one fixed threshold cell.
Suppose scores are in B2:B20 and the pass mark is stored in E1. With a score in B2 and the threshold in E1, this formula returns Pass when the score meets the threshold and keeps E1 fixed when copied down:
=IF(B2>=$E$1,"Pass","Fail")
The dollar signs make E1 an absolute reference. Select a reference in the formula and press F4 in Excel for Windows to cycle through reference types. On a Mac, the shortcut can depend on the keyboard and system settings; use the equivalent function-key combination if required, or type the dollar signs directly. Check that the formula points to the intended sheet and range, especially after inserting, deleting, or moving rows and columns.
Diagnose errors, text results, and calculation settings
Different symptoms point to different causes. A formula that Excel refuses to accept often has a separator, quote, or parenthesis issue. A formula that displays the formula itself may be stored as text, or Show Formulas may be turned on. If it is stored as text, change the cell format to General, edit the cell, and press Enter. On Windows, Ctrl+` toggles Show Formulas; the corresponding shortcut on Mac is Control+` on many keyboards.
If a formula returns an error such as #VALUE!, inspect the values and operations used by both branches and the logical test. If it returns FALSE when you expected a word, check whether the third argument was omitted. IF allows the false result to be left out, but then it returns FALSE when the test is false. If a formula returns an old result after its inputs change, check the calculation setting: on Windows, use Formulas > Calculation Options > Automatic. Excel for Mac also provides calculation options on the Formulas tab, though the exact interface can differ by version.
For a clearer diagnosis, select the formula cell and use Formulas > Evaluate Formula to step through how Excel evaluates the expression. You can also select a portion of a formula in the formula bar and press F9 to see its calculated value, but press Esc afterward rather than Enter so you do not replace the selected formula portion with that value.
When to use nested IF or another function
Nested IF functions can handle several outcomes, but long chains are harder to inspect and maintain. With a score in B2, this example assigns A to 90 or above, B to 80–89, and C to anything lower:
=IF(B2>=90,"A",IF(B2>=80,"B","C"))
The order matters: Excel checks the first test, then checks the second only if the first is false. Add more categories carefully, and test the values at each boundary. For many ranges or a grading table that changes, a lookup table may be easier to maintain than a deep chain of IF functions.
For several straightforward tests, IFS can be easier to read, but it is available in Microsoft 365 and Excel 2019 or later, not older Excel versions. AND and OR remain useful when the rule combines conditions. IFERROR is different: it returns a fallback when an expression produces an error, but it does not repair a mistaken logical test. Choose a function based on the rule, rather than adding functions to hide an unexpected result.
A quick troubleshooting sequence
Work through these checks in order rather than rewriting the entire formula at once:
- Click the cell and confirm Excel shows a formula beginning with an equals sign, not text beginning with an apostrophe.
- Check each comma, parenthesis, and pair of straight quotation marks. If Excel rejects commas, check whether your settings use semicolons.
- Read the logical test aloud and verify its operator, cell references, and cutoff values.
- Check whether the compared values are genuine numbers, dates, or text, and whether a blank-looking cell contains spaces or a formula.
- If the issue appears only after copying, inspect relative and absolute references in the affected row.
- If the displayed result is stale, check automatic calculation and evaluate the formula step by step.
Change one issue at a time and test a known true case and a known false case. For a threshold of 70, test 70 itself as well as a value below it; that quickly reveals whether the formula uses the intended inclusive or exclusive comparison.
Frequently Asked Questions
Why does my IF formula show the formula instead of the answer?
The cell may be formatted as Text, the formula may have a leading apostrophe, or Show Formulas may be enabled. Set the cell to General, edit and re-enter the formula, and check the Show Formulas toggle.
Why does Excel say there is a problem with my IF formula?
Check for missing parentheses, quotation marks, or argument separators. Your Excel regional settings may use semicolons instead of commas. Also make sure text results use straight double quotation marks.
Why does my IF formula return FALSE?
The condition is evaluating as false, and the formula may not include a third argument for the false result. Check the test and add the result you want Excel to return when the test is false.
Why does my IF formula work in one row but not another?
Copying a formula changes relative cell references. Compare the references row by row and use dollar signs to lock any threshold or lookup cell that should remain fixed.
Why does my IF formula treat a number like text?
The value may have been imported or pasted as text, even if it looks numeric. Check it with ISNUMBER, then convert it only if doing so will not remove meaningful formatting such as leading zeros.
Related
- Strikethrough Red in Excel: Steps and Workarounds
- How to Make a Custom Sorting List in Excel
- How to Strikethrough Numbers in Excel: Steps and Tips
Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.
More in Errors & fixes
- Excel MATCH Greater Than Not Working? Fixes That WorkExcel’s MATCH function does not treat a greater-than sign in its lookup value as a condition. For the…
- Excel All Cells Must Be the Same Size Error ExplainedThe Excel message “To do this, all the merged cells need to be the same size” usually means…
- Excel Shortcut Keys: Enable, Use, and Fix Common IssuesIn Excel for Microsoft 365 on Windows, keyboard shortcut keys are enabled by default; there is no master…
- Excel Not Working? Fix Common Problems Step by StepIf Excel is not working, first identify whether it will not open, has frozen, is showing unexpected results,…
- IRR Formula Not Working in Excel? Causes and FixesThe IRR formula usually fails because the cash-flow range is incomplete or contains no valid positive-and-negative combination, the…
- Excel File Format Is Not Valid: Causes and How to Fix ItIf Excel says a file format or file extension is not valid, first check that the file finished…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.