IF Function in Excel, Google Sheets, Airtable & Notion
IF checks a condition and returns one value when it is TRUE and another when it is FALSE. IF(78 >= 60, "Pass", "Fail") returns "Pass".
Syntax in each app
| App | Support | Syntax & notes |
|---|---|---|
| Excel | ✔ Built in | IF(logical_test, [value_if_true], [value_if_false]) |
| Google Sheets | ✔ Built in | IF(logical_expression, value_if_true, value_if_false) |
| Airtable | ✔ Built in | IF(expression, value1, [value2])Leave out value2 to get an empty cell when the test is false. |
| Notion | ✔ Built in | if(condition, value_if_true, value_if_false)Both results should be the same type (both text or both numbers). |
| Excel | =IF(78 >= 60, "Pass", "Fail") | open excel.new ↗ |
|---|---|---|
| Google Sheets | =IF(78 >= 60, "Pass", "Fail") | open sheets.new ↗ |
| Airtable | IF(78 >= 60, "Pass", "Fail") | |
| Notion | if(78 >= 60, "Pass", "Fail") |
Excel & Sheets use cell ranges. Paste this sample data into cell A1 of a blank sheet, then paste the formula into any empty cell.
In a real sheet the score would be a cell such as B2, a field such as {Score} in Airtable, or prop("Score") in Notion.
Arguments
| Argument | What it means |
|---|---|
logical_test | Anything that is TRUE or FALSE: a comparison such as B2>=60, a TRUE/FALSE cell, or a function like AND. |
[value_if_true] optional | What to return when the test is TRUE. Text must be in quotes. |
[value_if_false] optional | What to return when the test is FALSE. If omitted, Excel and Google Sheets return FALSE. |
Examples
| Formula | Result | Why | Copy |
|---|---|---|---|
=IF(78>=60, "Pass", "Fail") | Pass | ||
=IF(B2>1000, B2*5%, 0) | 5% bonus or 0 | Results can be calculations, not just text. | |
=IF(A2="", "Missing", A2) | A2 or "Missing" | Test for an empty cell with ="". | |
=IF(5>10, "Yes") | FALSE | With no value_if_false, Excel and Sheets return FALSE. |
Examples use Excel / Google Sheets syntax unless noted.
How IF works
IF is the basic decision-maker of every spreadsheet: flag overdue invoices, label pass or fail, apply a discount only above a threshold, or hide a result until its inputs are filled in. The test can be any comparison (=, <>, >, <, >=, <=) or any function that returns TRUE or FALSE. To combine several tests, put AND or OR inside the IF.
For more than two outcomes you can nest IFs — =IF(B2>=90, "A", IF(B2>=80, "B", "C")) — but they get hard to read fast. IFS lists the conditions in order without nesting, and SWITCH is cleaner when you are matching one value against a list of exact codes. Text comparisons in Excel and Google Sheets ignore case, so "yes"="YES" is TRUE.
Airtable uses the same IF but writes not-equal as != and returns an empty value if you leave out the false result. Notion's if() is lowercase and works with properties: if(prop("Score") >= 60, "Pass", "Fail"). Notion expects both results to have the same type, so wrap a number in format() if the other branch is text.
Frequently Asked Questions
- How many IFs can I nest?
- Excel allows 64 nested IFs, but anything beyond three or four is hard to maintain. Use IFS, SWITCH or a lookup table with XLOOKUP instead.
- How do I check if a cell is not empty?
- Use
=IF(A2<>"", "Has value", "Empty"). In Airtable writeIF({Field}, …)or{Field} != ""; in Notion useif(empty(prop("Field")), …, …).