IF tests something and gives one answer when the test passes and another when it fails. It is the building block almost every other conditional formula is made from.
Syntax
IF(logical_test, value_if_true, [value_if_false])
When to use it
Whenever a cell should say one thing in some circumstances and something else the rest of the time. Flagging what is overdue, hiding a zero, labelling a row.
What trips people up
Piling IF inside IF inside IF becomes hard to read fast. Past two or three levels, IFS is easier to read and easier to fix later.
Put AND or OR inside the test: =IF(AND(B2>100,C2="Yes"),"Bonus","") needs both to be true; OR needs only one.
Why does my IF show FALSE?
The third argument was left out, so when the test fails IF has nothing to show and returns FALSE. Add "" as the third argument to leave the cell blank instead.
How do I check whether a cell is empty?
=IF(A2="","Missing","OK"). ISBLANK works too, but it treats a formula that returns "" as not blank, which catches people out.
Related functions
IFS — IFS takes a series of tests and answers, and returns the answer belonging to the first test that passes.
IFERROR — IFERROR runs a formula and, if it comes back as an error, shows what you asked for instead.
Set by your computer's language, not by the file. A frequent cause of a correct-looking formula being rejected.
Excel version
XLOOKUP, IFS, TEXTBEFORE and TEXTJOIN need Microsoft 365 or 2021; older versions return #NAME? instead. Choosing the older one switches every walkthrough to a formula that works there.