IF
Performs a logical test and returns one value if TRUE, another if FALSE. The foundation of decision-making in Excel formulas.
IF(logical_test, value_if_true, [value_if_false])Arguments
logical_testThe condition to evaluate (TRUE or FALSE)value_if_trueThe value returned if the test is TRUEvalue_if_falseThe value returned if the test is FALSE(optional)
=IF(A1>10,"High","Low")Returns 'High' if A1>10, otherwise 'Low'
=IF(B1="Yes",100,0)Returns 100 if B1 is 'Yes', otherwise 0
=IF(A1>=60,"Pass","Fail")Classic grade pass/fail check
- •You can nest up to 64 IF functions in Excel
- •Consider using IFS for multiple conditions (Excel 2016+)
- •If value_if_false is omitted and test is FALSE, returns FALSE
- •Stacking five or six IFs inside each other because it's the first tool that comes to mind. It works, until you have to debug it six months later
- •Comparing text with = and expecting it to fail on case or spacing differences - Excel doesn't care, but your assumptions about the data might be wrong elsewhere
- •Skipping value_if_false and being confused later when the cell shows the word FALSE instead of just staying blank
IFSSwap to this the moment you're testing more than two or three conditions in a rowIFERRORFor catching a calculation error, not a custom condition you define yourselfSWITCHReads much better than nested IFs when you're really just matching one value against a list of optionsANDDrop it inside IF's logical_test when several conditions all need to be true at onceHow many conditions can I nest inside one IF formula?
Technically up to 64. Realistically, past 3-4 nested IFs the formula becomes a nightmare to read and debug. That's your cue to switch to IFS or a lookup table instead.
What does IF return if I omit value_if_false?
You get the boolean FALSE sitting in the cell, not a blank space like you might expect. If you want it empty, write value_if_false as "" explicitly.
Can IF test multiple conditions at once?
Yes, just not on its own - wrap AND() or OR() inside logical_test, for example IF(AND(A1>0,B1>0),"Both positive","No").
Need to translate a formula using IF?
Use our translator to convert your complete formula
