ExcelReady
CourseMock testsFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before day one. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Mock tests
  • Function guides
  • Blog

Test prep

  • Excel level test
  • Excel test practice
  • Free screening quiz
  • Certificate

Company

  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Logic
  3. IF Then Formula in Excel: Simple Examples to Copy

IF Then Formula in Excel: Simple Examples to Copy

By ExcelReady Team·Updated November 1, 2026·7 min read

The short answer

Excel has no THEN keyword: the IF function's second argument is the "then" part. Write =IF(test, value_if_true, value_if_false), for example =IF(B2>=60,"Pass","Fail"). If the score in B2 is 60 or more, the cell shows Pass; otherwise it shows Fail. Text results go in double quotes, numbers and calculations don't.

Key takeaways

  • The shape is =IF(test, then, else): the test, the result if true, the result if false.
  • Text results need double quotes, "Pass"; numbers and formulas don't.
  • Use comparison operators in the test: =, <>, >, <, >=, <=.
  • "" as a result leaves the cell looking blank.
  • For three or more outcomes, nest IFs or use IFS.
On this page+
  1. How an IF then formula is built
  2. Example 1: Pass or fail
  3. The comparison operators you can use in the test
  4. Example 2: Yes or no from a text match
  5. Example 3: Return a number or a calculation
  6. Example 4: Leave the cell blank
  7. Example 5: More than two outcomes
  8. Common IF then mistakes
  9. Practise it

An IF then formula in Excel works like a sentence: if this is true, then show that, otherwise show something else. Excel doesn't use the word THEN. Instead, the IF function takes three parts in order: =IF(test, value_if_true, value_if_false). This page is a set of short, correct examples you can copy and adapt, from pass/fail to bonuses and blank cells.

How an IF then formula is built#

Every IF formula has the same three parts, separated by commas:

Excel formula
=IF(logical_test, value_if_true, value_if_false)
PartPlain EnglishExample
logical_testIf this is true...B2>=60
value_if_truethen show this"Pass"
value_if_falseotherwise show this"Fail"

The test must give TRUE or FALSE. You build it with a comparison operator, such as >=. The IF function explained simply covers the theory in more depth; this page focuses on examples.

The first examples use this score list in A1:B7:

AB
1StudentScore
2Lena72
3Marco48
4Nia90
5Omar65
6Priya59
7Quinn81

Example 1: Pass or fail#

In C2, type the formula and fill it down (Windows: Ctrl+D; Mac: ⌘D):

Excel formula
=IF(B2>=60,"Pass","Fail")

Lena, Nia, Omar and Quinn show Pass. Marco (48) and Priya (59) show Fail. The words are in double quotes because they're text. Without the quotes, Excel looks for a name called Pass and shows #NAME?.

Keep the pass mark in a cell#

Typing 60 inside the formula works, but if the pass mark changes, you have to edit every row. Put the limit in its own cell instead, say E1, and point the test at it:

Excel formula
=IF(B2>=$E$1,"Pass","Fail")

The $ signs lock E1, so every row still checks against it after you fill down. Change E1 to 50 and Priya flips to Pass at once, with no formula edits. This is a good habit for any threshold: targets, budgets, deadlines or discount levels. It also makes the rule visible to anyone who opens the sheet, instead of hiding it inside a formula.

The comparison operators you can use in the test#

The test compares two things. These are the six operators Excel understands:

OperatorMeaningTestTRUE when
=equal toB2=100B2 is exactly 100
<>not equal toB2<>0B2 is anything but 0
>greater thanB2>60B2 is 61 or more (for whole numbers)
<less thanB2<60B2 is 59 or less
>=greater than or equal toB2>=60B2 is 60 or more
<=less than or equal toB2<=60B2 is 60 or less

Two traps: "not equal" is <>, not !=, and "greater than or equal" is >=, not =>. The lesson on TRUE, FALSE and comparisons lets you practise each one. For more on the difference between > and >=, see IF greater than in Excel.

Example 2: Yes or no from a text match#

To test text, put the text in double quotes inside the test as well:

Excel formula
=IF(C2="Paid","Yes","No")

This shows Yes when C2 holds Paid. The comparison isn't case-sensitive, so paid and PAID also match. A Yes/No column like this is handy for filters and counts; IF with Yes or No shows more versions. For partial matches, such as "contains Paid", see IF with text.

Example 3: Return a number or a calculation#

The then and else parts can be numbers or formulas. Leave the quotes off.

Excel formula
=IF(C2>=10000,C2*5%,0)

This pays a 5% bonus on sales of 10,000 or more and 0 below that. On sales of 12,400 the result is 620. On 9,800 it's 0.

Another common one checks a budget and shows the overspend:

Excel formula
=IF(C2>B2,C2-B2,0)

If actual spend in C2 is 1,150 and the budget in B2 is 1,000, the result is 150. If spend is under budget, it shows 0.

Example 4: Leave the cell blank#

Use "", two double quotes with nothing between them, to show nothing.

Excel formula
=IF(B2="","",B2*C2)

This multiplies quantity by price only when B2 has a value. Until then, the cell stays empty instead of showing 0. The same "" works as the then part, for example =IF(B2<60,"Retake","") flags only the students who need to retake.

Example 5: More than two outcomes#

When there are three or more results, put a second IF in the else part. This grades the scores:

Excel formula
=IF(B2>=80,"A",IF(B2>=60,"B","C"))

Excel checks the tests in order and stops at the first TRUE. Nia (90) and Quinn (81) get A, Lena (72) and Omar (65) get B, Marco and Priya get C. Always test the biggest threshold first; otherwise 90 would stop at >=60 and get B.

In Excel 2019, 2021 and Microsoft 365, IFS reads more easily:

Excel formula
=IFS(B2>=80,"A",B2>=60,"B",TRUE,"C")

The final TRUE acts as "everything else".

To check two conditions at once, such as a score of 60 or more and full attendance, combine IF with AND; see IF with AND.

Common IF then mistakes#

Check these when your formula won't work:

  1. Missing quotes around text. =IF(B2>=60,Pass,Fail) returns #NAME?.
  2. Quotes around numbers. =IF(B2>=60,"1","0") returns text, which SUM ignores. Use 1 and 0.
  3. Wrong operator. => and != don't exist in Excel.
  4. Nested IFs in the wrong order. Test the highest threshold first.
  5. Numbers stored as text. A score typed as text won't compare correctly with 60. Convert it with VALUE.

The IF function guide is a one-page reference for the syntax.

Practise it#

IF formulas show up in almost every Excel job test, usually in the first few questions. Practise the IF function in a live spreadsheet: you type the formula and it checks it instantly. Then practise TRUE, FALSE and comparisons to get the operators right first time, and try the basic Excel test when you're ready.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

The pass mark is 60. Click C3 and write an IF formula that shows Pass if Marco's score in B3 is 60 or more, and Fail if not.

fx
ABCD
1
Student
Score
Result
2
Lena
72
3
Marco
48
4
Nia
90
5
Omar
65
6
Priya
59
7
Quinn
81
8
9
10

Tip: The test is B3>=60. Then "Pass", then "Fail", each in double quotes.

Practise this in a lesson

LessonThe IF functionMake a cell show one result or another depending on a condition, like Pass/Fail or Over/Under budget.LessonTRUE, FALSE and comparisonsAsk Excel yes-or-no questions with =, <>, >, <, >= and <=, and get TRUE or FALSE back. The building block of every IF.Function guideIFLearn Excel's IF function with practical examples: flag budgets, label rows and return blanks. Avoid the classic mistakes and practice live.

Frequently asked questions

How do I write an if then formula in Excel?

+

Use =IF(condition, result if true, result if false). For example, =IF(C2>1000,"Over budget","OK") shows Over budget when C2 is more than 1000 and OK otherwise.

Does Excel have an IF THEN function?

+

No separate one. The IF function does it: the first argument is the if part, the second is the then part, and the third is the else part.

How do I make IF return a blank cell?

+

Use two double quotes as the result: =IF(B2="","",B2*C2). The cell looks empty, although it technically holds empty text.

Can an IF formula do a calculation?

+

Yes. Put the calculation in the true or false argument without quotes, for example =IF(C2>=10000,C2*5%,0) to pay a 5% bonus only on sales of 10,000 or more.

How do I write IF with more than two outcomes?

+

Nest a second IF in the false argument, =IF(B2>=80,"A",IF(B2>=60,"B","C")), or use IFS in Excel 2019 and later: =IFS(B2>=80,"A",B2>=60,"B",TRUE,"C").

Sources

  • IF function - Microsoft Support
  • IFS function - Microsoft Support
  • Calculation operators and precedence in Excel - Microsoft Support

Written and checked by the ExcelReady Team. First published November 1, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. How an IF then formula is built
  2. Example 1: Pass or fail
  3. The comparison operators you can use in the test
  4. Example 2: Yes or no from a text match
  5. Example 3: Return a number or a calculation
  6. Example 4: Leave the cell blank
  7. Example 5: More than two outcomes
  8. Common IF then mistakes
  9. Practise it

Keep reading

Logic· 6 min read

The Excel IF Function Explained Simply

The Excel IF function checks a condition and returns one value when it's TRUE and another when it's FALSE. The syntax is =IF(logical_test, value_if_true, value_if_false). For example, =IF(B2>=70,"Pass","Fail") shows Pass for a score of 70 or more and Fail for anything lower. Text results go in double quotes.

Logic· 6 min read

IF Greater Than in Excel (and Greater Than or Equal)

To test if a value is greater than another in Excel, use > inside IF: =IF(B2>C2,"Above target","Not above"). For greater than or equal to, use >=, which also passes when the two values are the same. You can compare with a number, another cell or a date, and return text, a number or a calculation.

Logic· 6 min read

Return Yes or No in Excel With IF

To return Yes or No in Excel, put a test inside IF: =IF(B2>=100,"Yes","No"). If the test is TRUE, the cell shows Yes; if it is FALSE, it shows No. A comparison on its own, like =B2>=100, returns TRUE or FALSE, so IF is what turns that answer into the words Yes and No.

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback, right in your browser. Nothing to download.

Start learning for free