Excel IF Formula Explained With Examples
IF evaluates a logical test and returns one of two outcomes. Build and test the condition first, then add results that match the intended data type.
What to do
- A basic example is
=IF(C2>=50,"Pass","Review"). Excel checks whether C2 is at least 50, then returns the matching text. - For a blank check, use
=IF(A2="","Missing","Entered"). This is useful for simple status labels. - Combine tests with AND or OR, for example
=IF(AND(B2>=50,C2="Complete"),"Ready","Check"). - Copy the formula down a test dataset and manually verify cases just above, equal to, and below the threshold.
Checks and limitations
- Text results need quotation marks; cell references and numeric values do not.
- Nested IF formulas can become hard to maintain. For many categories, consider IFS or a lookup table if your Excel version supports them.
What IF does
Use IF to test a condition and return one result when it is true and another when it is false.
Syntax
=IF(logical_test, value_if_true, [value_if_false])
Copyable formula
=IF(C2>=100,"Target met","Below target")Example result: Target met.
Example data
| Item | Region | Sales | Status |
|---|---|---|---|
| Widget | North | 120 | Paid |
| Cable | South | 80 | Paid |
| Widget | North | 200 | Pending |
| Desk | North | 150 | Paid |
Real-world use
Label each order as meeting or missing a sales threshold, then copy the formula down the table.
Common mistakes
- Text results require quotation marks; cell references do not.
- Testing a boundary incorrectly, such as using > when the threshold should include equal values.
Alternative formulas
IFS can simplify several exclusive conditions where supported. AND and OR combine logical tests.
Compatibility
IF is supported by essentially all current spreadsheet versions. Newer functions such as IFS may not work in older versions.
Frequently asked questions
Does IF return text or numbers?
Either: the true and false results can be text, numbers, references, or other formulas.
How can I test more than one condition?
Use AND or OR inside the logical_test, or use nested IF/IFS when the cases are mutually exclusive.
Browse the Excel formula library ยท Open the percentage calculator