Logic function

IF

Choose between two answers.

Purpose

Give one answer when a test holds and another when it does not

Returns

The second argument if the test is TRUE, the third if it is FALSE

Syntax

=IF(test, if_true, [if_false])

ArgumentRequiredWhat goes here
testRequiredA comparison, like B2>10 or C2="Pastry".
if_trueRequiredWhat to give back when the test holds.
if_falseOptionalWhat to give back otherwise. Often the next IF, for a further band.

How to use IF

IF takes a test, an answer for when it holds, and an answer for when it does not. The test is anything that comes out TRUE or FALSE, which in practice means a comparison: D2>30, C2="Overdue", E2>=1000.

Text answers go in quotation marks. Numbers and cell references do not. Leaving the third argument out gives FALSE back when the test fails, which is almost never what a schedule wants to show.

IF only ever works out the branch it lands on. That is what lets you put a division in one branch and a message about a zero in the other without the division ever running.

Nesting one IF inside another gives you bands, but past two or three levels it becomes hard to read and IFS says the same thing more plainly.

Examples

Every result below is worked out by the same evaluator that marks your answers, on the sheet shown here.

Payables ageing — October.xlsxSheet1
Harbour Foods payables at 31 October 2026, with supplier terms alongside
ABCDEFGH
1InvoiceSupplierStatusDays overdueAmountSupplierTerms (days)
2INV-8801Brightwell PaperOverdue12940Ashgrove Catering30
3INV-8802Calder UtilitiesQueried471180Brightwell Paper30
4INV-8803Meridian FreightOverdue632450Calder Utilities14
5INV-8804Ashgrove CateringOn terms0405Meridian Freight45
6INV-8805Brightwell PaperOverdue38760Thornbury Print60
7INV-8806Thornbury PrintOverdue911320
8INV-8807Meridian FreightOn terms0580
9INV-8808Calder UtilitiesOverdue24215
FormulaResult
=IF(D2>30,"Chase","Leave")Twelve days is not more than thirty, so the FALSE branch answers.Leave
=IF(E4>1000,"Manager approval","Standard")The same shape applied to an amount rather than an age.Manager approval
=IF(D7>90,"Write-off review",IF(D7>60,"Escalate","Chase"))One IF inside another. The outer test is checked first, so the widest band has to come first or nothing ever reaches it.Write-off review
=IF(AND(D4>30,E4>500),"Chase","Leave")AND inside the test slot, which is how you ask for two conditions at once.Chase

Notes

  • A missing third argument returns FALSE, not an empty cell. Write "" if you want the cell to look empty.
  • IF returns whatever you put in the branch, so the same formula can hand back text in one case and a number in the other. A column mixing the two will not total.
Practise IF in Unit 09

A reference tells you what it does. A unit makes you use it.