Recommended Free Tools
Use Excel’s IF function to test a condition and return one result when it is true and another when it is false. Its basic syntax is =IF(logical_test, value_if_true, [value_if_false]). For example, =IF(A2>B2,"Over Budget","OK") displays “Over Budget” when A2 is greater than B2 and “OK” otherwise. The syntax is established Excel functionality, not a change introduced for 2026.
How the IF formula works
An IF formula has three parts: a test, a result for a true test, and an optional result for a false test. Microsoft’s IF function guide describes it as a logical comparison that returns a result depending on whether the condition is true or false.
As an Amazon Associate I earn from qualifying purchases.
In =IF(logical_test, value_if_true, [value_if_false]), the square brackets indicate that the third argument is optional; do not type the brackets into the formula. If you omit the false result, Excel returns FALSE when the test is false.
Free tools Windows power users keep installed
One-click scans. No signup required.
logical_testis the condition to evaluate, such asA2>B2orC2="Yes".value_if_trueis what Excel returns if that condition is met.value_if_falseis what Excel returns otherwise; choose it explicitly when you want a useful alternative toFALSE.
How to enter an IF formula
- Select the cell where you want the result.
- Type
=IF(, then enter the condition, such asA2>B2orC2="Yes". - Type a comma and the result for a true condition. Put literal text in quotation marks, for example
"Over Budget"; numbers do not need quotation marks. - Type another comma and the result for a false condition, then close the parenthesis. Press Enter.
- Adapt the cell references and outputs to match your worksheet.
For example, =IF(C2="Yes",1,2) returns 1 when C2 contains “Yes” and 2 otherwise. Excel’s Formula AutoComplete can suggest function names and arguments as you type = and the start of a function name; see Microsoft’s guide to using functions and nested functions.
IF formula examples you can adapt
| Purpose | Formula | What it returns |
|---|---|---|
| Compare two amounts | =IF(A2>B2,"Over Budget","OK") |
“Over Budget” if A2 is greater than B2; otherwise “OK.” This follows Microsoft’s example in its IF function guide. |
| Check a score | =IF(A2>=70,"Pass","Check") |
“Pass” at 70 or higher; “Check” below 70. The threshold is illustrative, not a Microsoft grading standard. |
| Return a status from text | =IF(C2="Yes","Ready","Wait") |
“Ready” when C2 matches “Yes”; otherwise “Wait.” |
| Return a calculation or blank | =IF(A2=B2,B4-A4,"") |
Calculates B4 minus A4 when A2 equals B2; otherwise returns an empty text string, so the cell appears blank. This is a Microsoft-documented example. |
Use AND or OR when a test has multiple conditions
Combine a test with AND when every condition must be true, or with OR when any one condition is enough. Microsoft’s guide to IF with AND, OR, and NOT includes examples using numbers, text, and dates.
- Every condition must hold:
=IF(AND(A2>0,B2<100),"Pass","Check")returns “Pass” only if A2 is greater than 0 and B2 is less than 100. - Either condition may hold:
=IF(OR(A2="Yes",B2="Yes"),"Eligible","No")returns “Eligible” if either cell contains “Yes.”
Choose nested IF or IFS for ordered outcomes
When you need several outcomes in sequence, a nested IF puts another IF in the false-result argument. For example, Microsoft’s grade formula checks from the highest threshold down: =IF(D2>89,"A",IF(D2>79,"B",IF(D2>69,"C",IF(D2>59,"D","F")))). The order matters: test the highest cutoff first, or a broader condition could capture a value intended for a higher grade. Microsoft explains this pattern and its maintenance trade-offs in IF function: nested formulas and avoiding pitfalls.
Rank #2
Where available, IFS expresses ordered condition-and-result pairs without nesting each IF: =IFS(D2>89,"A",D2>79,"B",D2>69,"C",D2>59,"D",TRUE,"F"). The final TRUE,"F" pair supplies the default when none of the earlier conditions matches. Without a matching condition, IFS can return #N/A. Microsoft lists IFS for Microsoft 365, Excel 2024, Excel 2021, and Excel 2019 in its IFS function reference; check the version you use rather than assuming the function is available in every spreadsheet application.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Use the approach that fits the logic and the people who will maintain the sheet:
Rank #3
| Approach | Best fit | Main consideration |
|---|---|---|
| One IF | One condition with two possible outcomes | Choose both outcomes deliberately; the false result can be omitted, but then Excel returns FALSE. |
| IF with AND or OR | One outcome depends on multiple requirements | AND requires every test to pass; OR requires at least one. |
| Nested IF | Several ordered conditions, including versions without IFS | Long chains are harder to build, check, and update. |
| IFS | Several ordered conditions in a supported Excel version | Add a final default condition if unmatched values need a defined result. |
Microsoft also documents conditional formulas in its Create conditional formulas guide.
Quick Recap
Rank #4
Check common IF formula problems
- Literal text needs quotation marks. Write
"Yes"for text in a test or result, notYes. - Close every function call. A nested formula needs one closing parenthesis for each open IF or other function.
- Check threshold order and boundaries. Test representative values at, just below, and just above each cutoff to confirm that every value gets the intended result.
- Define what happens when nothing matches. For IFS, a final
TRUE,"Default"pair is one way to cover remaining cases. - Simplify formulas that are hard to audit. A helper column can make intermediate tests visible; IFS may make ordered logic easier to read in a supported version. Microsoft cautions that complex nested formulas are difficult to build, test, and update.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




