ExcelReady
CourseFunction guidesBlog
Start freeStart learning for free
ExcelReady

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

Learn

  • Course
  • Function guides
  • Blog

Product

  • Certificate

Company

  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Logic
  3. The Excel IF Function Explained Simply

The Excel IF Function Explained Simply

By ExcelReady Team·Updated October 30, 2026·6 min read

The short answer

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.

Key takeaways

  • IF has three parts: a test, the result when the test is TRUE, and the result when it is FALSE.
  • Text results need double quotes; numbers, cell references and calculations don't.
  • Put limits like a pass mark in their own cell and lock it with $ so you only change it once.
  • If you leave out the FALSE result, IF shows the word FALSE instead of a blank.
  • For more than two outcomes, use a nested IF or IFS; for several conditions, add AND or OR.
On this page+
  1. How does the Excel IF function work?
  2. How to write an IF formula, step by step
  3. How do you use IF with text?
  4. Can IF return a number or a calculation?
  5. Why put the limit in a cell instead of the formula?
  6. Why is my IF formula not working?
  7. What if you need more than two results or several conditions?
  8. Practise it

The Excel IF function lets a cell make a simple decision: if a condition is true, show one thing; if not, show something else. It's the formula behind Pass/Fail columns, Over/Under budget flags and bonus checks. This guide is for beginners and job seekers who want to write IF formulas with confidence, including in a timed Excel test.

How does the Excel IF function work?#

IF takes a yes-or-no test and returns one of two results. The syntax is:

Excel formula
=IF(logical_test, value_if_true, value_if_false)
PartWhat it meansExample
logical_testA question with a TRUE or FALSE answerB2>=70
value_if_trueWhat to show when the answer is TRUE"Pass"
value_if_falseWhat to show when the answer is FALSE"Fail"

The test is usually a comparison such as B2>=70 ("is B2 at least 70?"). If comparisons are new to you, start with how TRUE, FALSE and the comparison signs work. You can also practise them in the TRUE, FALSE and comparisons lesson.

How to write an IF formula, step by step#

Write the test first, then the two results, separated by commas. Here is a small list of test scores with a pass mark of 70:

ABC
1EmployeeTest ScoreResult
2Priya82
3Marcus64
4Elena70
5Tom91
  1. Click C2.
  2. Type =IF(B2>=70,"Pass","Fail") and press Enter. Priya's 82 is at least 70, so C2 shows Pass.
  3. Copy the formula down to C5. Select C2:C5 and press Ctrl+D (Windows) or ⌘D (Mac). The reference B2 moves to B3, B4 and B5 as you fill.

The results are Pass, Fail, Pass and Pass. Look at Elena: she scored exactly 70 and passes, because >= means "greater than or equal to". With > she would fail, since 70 is not greater than 70. Most IF mistakes in tests come from choosing > when the task says "at least".

How do you use IF with text?#

Put text in double quotes, both in the test and in the results. For example, to label customers by city:

Excel formula
=IF(B2="Leeds","North","Other")

Two things to know about text tests:

  • Capital letters don't matter. "LEEDS", "Leeds" and "leeds" all match. If case matters, use =IF(EXACT(B2,"Leeds"),...).
  • Spaces do matter. "Leeds " with a trailing space is not equal to "Leeds". Data copied from other systems often has hidden spaces, so wrap the cell in TRIM if results look wrong: =IF(TRIM(B2)="Leeds",...).

Without the quotes, Excel thinks Leeds is a name it should know, and you get a #NAME? error.

Can IF return a number or a calculation?#

Yes. The results can be numbers, cell references or whole calculations, and those don't need quotes. Take a budget sheet where B is the budget and C is the actual spend:

DepartmentBudgetActual=IF(C2>B2,"Over","Under")=IF(C2>B2,C2-B2,0)
Marketing1200013450Over1450
Sales1800016200Under0
IT2500025000Under0

The second formula shows how much each department overspent, and 0 when it didn't. Don't type "0" in quotes: that is text, and SUM skips text, so your total would be wrong. Notice IT: it spent exactly its budget, and 25000 is not greater than 25000, so it counts as Under.

To leave a cell empty instead of showing 0, use two double quotes with nothing between them: =IF(C2>B2,C2-B2,"").

The same trick works in the test. A common pattern skips rows that have no data yet:

Excel formula
=IF(C2="","",IF(C2>B2,"Over","Under"))

If C2 is empty, the cell stays empty. Otherwise the inner IF does the real check. Without this, an empty Actual cell counts as 0, and every department with no figures yet shows Under, which looks like good news but isn't.

Why put the limit in a cell instead of the formula?#

A limit in its own cell can change without editing a single formula. Typing 70 into every IF means you must edit every row when the pass mark changes. Instead, put the pass mark in a cell such as G1 and point at it:

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

The dollar signs lock G1, so every row still points at it after you fill down. Press F4 (Windows) or ⌘T (Mac) while the cursor is on G1 to add them. Change G1 to 75 and the whole column updates. Interviewers notice this habit, because it is how real reports stay correct. Learn more about absolute references and the dollar sign.

Why is my IF formula not working?#

Most broken IF formulas have one of these problems:

ProblemWhat you seeFix
Text result without quotes: =IF(B2>=70,Pass,Fail)#NAME?Write "Pass" and "Fail"
No third part: =IF(B2>=70,"Pass")FALSE for low scoresAdd ,"Fail"
=> instead of >=Excel won't accept the formulaThe < or > sign comes first: >=, <=
Number in quotes: =IF(B2>="70",...)Always the FALSE resultRemove the quotes: B2>=70
Score stored as text, like '58A low score shows PassConvert the cell to a real number

The last two catch many people. When Excel compares a number with text, it treats text as larger than any number. So a score imported as text, such as '58, passes >=70. Check suspicious cells with ISNUMBER and the other IS functions.

Curly "smart" quotes copied from a web page or Word also break formulas. Retype them as straight quotes (") in Excel.

What if you need more than two results or several conditions?#

IF only chooses between two results, but you can combine it with other functions:

  • More than two outcomes, like grades A, B, C and F: put another IF in the FALSE slot. See how nested IF handles grades and bands.
  • A cleaner list of outcomes in Excel 2019 or Microsoft 365: use the IFS function, which needs no nesting.
  • Two or more conditions at once, like "sales over 50000 and a rating of at least 4.5": put AND or OR inside the test. See AND, OR and NOT with IF.

For a quick reference to every argument, read the IF function guide.

Practise it#

You learn IF fastest by writing it, not by reading it. Try the exercise on this page, then work through the IF function lesson in a live spreadsheet. It covers Pass/Fail, a pass mark in its own cell and IF with calculations, and it checks each answer as you go.

Try it yourself

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

Each department has a budget and an actual spend. In D2, show Over if the actual spend in C2 is greater than the budget in B2, and Under if it isn't. Type =IF(C2>B2,"Over","Under") and press Enter.

fx
ABCDE
1
Department
Budget
Actual
Status
2
Marketing
12000
13450
3
Sales
18000
16200
4
IT
25000
25000
5
HR
8000
7350
6
Operations
30000
31800
7
8
9

Tip: The test is: is Actual (C2) bigger than Budget (B2)? Then the TRUE result, then the FALSE result, each in 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 formula in Excel?

+

Type =IF( then a test, a comma, the result for TRUE, a comma, and the result for FALSE, then close the bracket. For example, =IF(B2>=70,"Pass","Fail").

Can an IF formula leave the cell blank?

+

Yes. Use two double quotes with nothing between them as the result, like =IF(C2>B2,C2-B2,""). The cell then looks empty, although it holds empty text.

Why does my IF formula return FALSE?

+

You probably left out the third part, value_if_false. When the test is FALSE and there is no third part, Excel shows the word FALSE. Add a comma and the result you want.

Can I use IF with text?

+

Yes. Put the text in double quotes, like =IF(B2="Leeds","North","Other"). The comparison ignores capital letters, so LEEDS and Leeds both match.

How many IFs can I nest in Excel?

+

Excel 2007 and later allow up to 64 nested functions in one formula. In practice, more than three or four IFs is hard to read, so consider IFS or a lookup table.

Sources

  • IF function - Microsoft Support

Written and checked by the ExcelReady Team. First published October 30, 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 does the Excel IF function work?
  2. How to write an IF formula, step by step
  3. How do you use IF with text?
  4. Can IF return a number or a calculation?
  5. Why put the limit in a cell instead of the formula?
  6. Why is my IF formula not working?
  7. What if you need more than two results or several conditions?
  8. Practise it

Keep reading

Logic· 6 min read

Nested IF in Excel: Grades, Bands and Tiers

A nested IF puts a second IF in the value_if_false slot of the first, so one formula can return three or more results. For grades: =IF(B2>=90,"A",IF(B2>=80,"B",IF(B2>=70,"C","F"))). Excel checks the tests in order and stops at the first TRUE one, so test the highest band first.

Logic· 6 min read

The Excel IFS Function: Cleaner Than Nested IFs

The Excel IFS function checks a list of conditions in order and returns the result paired with the first TRUE one: =IFS(test1, value1, test2, value2, ...). It replaces nested IFs without the brackets. IFS has no "otherwise" result, so end with TRUE and a fallback value. It needs Excel 2019 or later.

Logic· 7 min read

AND, OR and NOT in Excel With IF

AND returns TRUE only when every condition is TRUE. OR returns TRUE when at least one condition is TRUE. NOT flips TRUE to FALSE and FALSE to TRUE. On their own they give TRUE or FALSE, so you usually put them inside IF's test, like =IF(AND(C2>=50000,D2>=4.5),"Bonus","No bonus").

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback. The first lessons are free, with no download.

Start learning for free