Make a decision with IF
Let a cell choose between two answers: flag lines that are over budget, show a status, or calculate only when a condition is true.
FormulasBeginner10 minExcel · Google Sheets
Example content. The numbers are fictional and made for learning.
Goal
Show how much a budget line went over, or 0 when it stayed within budget.
Why this is useful
Most spreadsheets need a rule: is it paid, is it late, is it over? IF turns that rule into a cell that updates by itself, so you stop checking by eye.
Example
| Row | A | B | C |
|---|---|---|---|
| 1 | Line | Budget | Actual |
| 2 | Marketing | 400 | 460 |
| 3 | Software | 120 | 95 |
| 4 | Travel | 200 | 200 |
| 5 | Over budget (Marketing) | 60.00=IF(C2>B2,C2-B2,0) |
Steps
1. Write the question
Say it in words first: if actual is more than budget, show the difference, otherwise show 0.
2. Type the test
Start with =IF( and the comparison, C2>B2. The comparison uses > < = >= <= or <> for not equal.
3. Add the two answers
After a comma, give the answer when the test is true (C2-B2), then the answer when it is false (0). Close the parenthesis: =IF(C2>B2,C2-B2,0).
4. Use words as answers
Answers can be text in quotes: =IF(C2>B2,"Over","OK"). Excel and Google Sheets show the word, not the quotes.
5. Combine conditions
Put AND or OR inside the test when two things matter: =IF(AND(B2>1000,C2="Open"),"Chase","").
Formulas by language
Cell names such as B2 stay the same. The function name and the character between arguments follow the spreadsheet language. The English line in each list is the reference form used on this site, not a universal spelling. When the decimal sign is a comma, arguments are usually separated with a semicolon, because the comma is already used in numbers.
How much over budget, or 0.
English (United States)
Decimals look like 1.5. Arguments are separated with ,.
=IF(C2>B2,C2-B2,0)Swedish (Sweden)
Decimals look like 1,5. Arguments are separated with ;.
=OM(C2>B2;C2-B2;0)German (Germany)
Decimals look like 1,5. Arguments are separated with ;.
=WENN(C2>B2;C2-B2;0)French (France)
Decimals look like 1,5. Arguments are separated with ;.
=SI(C2>B2;C2-B2;0)Spanish (Spain)
Decimals look like 1,5. Arguments are separated with ;.
=SI(C2>B2;C2-B2;0)Spanish (Mexico)
Decimals look like 1.5. Arguments are separated with ,.
=SI(C2>B2,C2-B2,0)Portuguese (Brazil)
Decimals look like 1,5. Arguments are separated with ;.
=SE(C2>B2;C2-B2;0)Italian (Italy)
Decimals look like 1,5. Arguments are separated with ;.
=SE(C2>B2;C2-B2;0)Dutch (Netherlands)
Decimals look like 1,5. Arguments are separated with ;.
=ALS(C2>B2;C2-B2;0)
A status word instead of a number.
English (United States)
Decimals look like 1.5. Arguments are separated with ,.
=IF(C2>B2,"Over","OK")Swedish (Sweden)
Decimals look like 1,5. Arguments are separated with ;.
=OM(C2>B2;"Over";"OK")German (Germany)
Decimals look like 1,5. Arguments are separated with ;.
=WENN(C2>B2;"Over";"OK")French (France)
Decimals look like 1,5. Arguments are separated with ;.
=SI(C2>B2;"Over";"OK")Spanish (Spain)
Decimals look like 1,5. Arguments are separated with ;.
=SI(C2>B2;"Over";"OK")Spanish (Mexico)
Decimals look like 1.5. Arguments are separated with ,.
=SI(C2>B2,"Over","OK")Portuguese (Brazil)
Decimals look like 1,5. Arguments are separated with ;.
=SE(C2>B2;"Over";"OK")Italian (Italy)
Decimals look like 1,5. Arguments are separated with ;.
=SE(C2>B2;"Over";"OK")Dutch (Netherlands)
Decimals look like 1,5. Arguments are separated with ;.
=ALS(C2>B2;"Over";"OK")
Two conditions that must both be true.
English (United States)
Decimals look like 1.5. Arguments are separated with ,.
=IF(AND(B2>1000,C2="Open"),"Chase","")Swedish (Sweden)
Decimals look like 1,5. Arguments are separated with ;.
=OM(OCH(B2>1000;C2="Open");"Chase";"")German (Germany)
Decimals look like 1,5. Arguments are separated with ;.
=WENN(UND(B2>1000;C2="Open");"Chase";"")French (France)
Decimals look like 1,5. Arguments are separated with ;.
=SI(ET(B2>1000;C2="Open");"Chase";"")Spanish (Spain)
Decimals look like 1,5. Arguments are separated with ;.
=SI(Y(B2>1000;C2="Open");"Chase";"")Spanish (Mexico)
Decimals look like 1.5. Arguments are separated with ,.
=SI(Y(B2>1000,C2="Open"),"Chase","")Portuguese (Brazil)
Decimals look like 1,5. Arguments are separated with ;.
=SE(E(B2>1000;C2="Open");"Chase";"")Italian (Italy)
Decimals look like 1,5. Arguments are separated with ;.
=SE(E(B2>1000;C2="Open");"Chase";"")Dutch (Netherlands)
Decimals look like 1,5. Arguments are separated with ;.
=ALS(EN(B2>1000;C2="Open");"Chase";"")
The same spoken language can use different separators in different countries. Spanish in Spain often uses a comma for decimals and a semicolon between arguments. Spanish in Mexico often uses a period and a comma. If a formula is rejected, check the spreadsheet locale.
Excel and Google Sheets
- IF takes the same three arguments in current Excel and Google Sheets: test, value if true, value if false.
- Text answers go in straight double quotes. Curly quotes copied from a document are not accepted.
- Function names and the separator between arguments follow the spreadsheet language. Excel uses the language of your installation; Google Sheets uses the spreadsheet locale under File, Settings.
- Workbooks from Hellosheetwise store formulas in English. Excel and Google Sheets show them in your language when you open the file.
If something goes wrong
The cell shows FALSE.
The third argument is missing. Add the answer for when the test is not true, for example 0 or "".
Text answers are rejected.
Use straight quotes " " around the words, not curly quotes.
Every row shows the same answer.
Check the cell names after copying the formula down. Each row should test its own cells, such as C3>B3 on row 3.