Most IF formula problems come from a short list of causes. Start by checking the formula’s text, then the data it reads, because a formula can be written correctly and still receive the wrong input.
Look at the formula itself
Press Ctrl+` (the grave accent key, usually above Tab) to switch the sheet between showing results and showing formulas. The same option is on the Formulas tab as Show Formulas. Looking at the formulas can reveal a missing parenthesis or a reference that points somewhere unexpected.
If a cell shows the formula as plain text rather than a result, it was probably formatted as Text before the formula was typed. Change the format to General, then enter the formula again.
For a step-by-step check, the Evaluate Formula tool on the Formulas tab shows the value of each part of the formula as Excel works it out. How to use evaluate formula in excel covers it.
Text without quotes gives #NAME?
=IF(B2=Paid, "Yes", "No") makes Excel look for a name called Paid. No such name exists, so the result is #NAME?. Text in a formula needs quotes:
=IF(B2="Paid", "Yes", "No")
For other causes of #NAME?, see why does excel show #name error.
Numbers stored as text
A number that Excel reads as text is usually aligned to the left of its cell, and it may carry a small green triangle in the corner. Comparisons between text and numbers behave differently. In Excel, any text counts as larger than any number in a comparison. A value stored as the text “40” can therefore seem to pass a test such as >=50.
To fix this, convert the values to real numbers. How to convert text to number in excel shows the methods.
Stray spaces
“Yes “ with a trailing space doesn’t match “Yes”, even though the two look the same. Wrap the cell in TRIM inside the test:
=IF(TRIM(B2)="Yes", "Yes", "No")
To clean up the data itself, which is often the better fix when many cells are affected, see remove extra spaces in excel formula.
FALSE in the result
When the test is FALSE and the formula has no value_if_false, Excel shows FALSE. A result of FALSE often means the last part of the formula is missing. Add the result you want for the false case:
=IF(B2="Paid", "Yes", "No")
Overlapping tests in a nested IF
In a nested IF, Excel stops at the first TRUE test. If an early test catches values that a later one was meant to handle, the later results never appear. Check the order of the tests, starting with the highest threshold. The order rule is explained in how to write nested if formulas in excel.
Copied formulas and shifted references
A reference that moves when you copy a formula can point to the wrong cell. A formula that works in the first row can give a different answer in the tenth. Dollar signs keep a reference fixed. For how references change when a formula moves, see why does copied formula give wrong result in excel.
Calculation set to manual
When calculation is set to manual, Excel doesn’t update formulas after you change a value, so the results look stale. Go to the Formulas tab, open Calculation Options, and choose Automatic. In manual mode, pressing F9 recalculates the workbook.
When the result is an error
An IF formula can show an error when the data it checks causes one, for example text that is used in math inside the formula. A #VALUE! error usually points to a value of the wrong type. For the common causes, see how to fix #value error in excel. The full list of error types is in excel formula error messages explained.
Rebuild the formula in steps
If the cause still isn’t clear, cut the formula down to its test alone. Check that the test returns TRUE or FALSE for the row you care about. Then add the results back one at a time, checking after each change.