The IF function lets Excel test a condition and return one result when it is true and another when it is false. It is the formula behind common labels such as Pass or Fail, Reorder or In Stock, and bonus or zero.
Does this affect you?
Use this for Excel for Microsoft 365, Excel 2021, Excel 2019, and Excel for the web when a spreadsheet needs decisions based on values, text, dates, or other conditions.
Write a basic IF formula
Every IF formula has three parts: the test, the true result, and the false result.
- Click the cell where the answer should appear.
- Type =IF(.
- Enter the condition, such as B2>=60.
- Add a comma and the result to show when true, such as “Pass”.
- Add another comma and the result to show when false, such as “Fail”.
- Close the formula and press Enter.
- Example: =IF(B2>=60,”Pass”,”Fail”).
- Copy or fill the formula down if other rows need the same logic.
Text results need quotation marks. Numbers and cell references usually do not. A missing quotation mark is a common cause of #NAME? errors.
Check more than one condition
Use AND or OR inside IF when one test is not enough.
- Use AND when all conditions must be true, such as =IF(AND(B2>=60,C2=”Yes”),”Pass”,”Fail”).
- Use OR when any condition can be true, such as =IF(OR(B2>=90,C2=”Honor Roll”),”Pass”,”Fail”).
- For several outcomes, nest another IF in the false result, such as grading by score tiers.
- Watch the parentheses carefully; Excel color-codes matching pairs while you type.
More control
Use IFS for many outcomes
In Microsoft 365 and newer Excel versions, IFS lists condition/result pairs and is easier to read than several nested IF formulas. Add TRUE as the final catch-all condition.
Show a blank result
Use empty quotes when one outcome should display nothing, such as =IF(B2>=60,”Pass”,””). If you omit the false result, Excel may show FALSE.
Use lookups for long lists
If you are mapping many product names, codes, or score bands to results, a lookup table with VLOOKUP, XLOOKUP, or INDEX MATCH can be cleaner than a long IF chain.
Sources
- Microsoft Support – IF function (2025)
- Microsoft Support – IFS function (2025)
- Microsoft Support – Using nested functions in a formula (2025)
