Excel IF Formula Syntax
=IF(logical_test, value_if_true, value_if_false)The logical test asks a yes/no question. If the answer is TRUE, Excel returns the second argument. If the answer is FALSE, Excel returns the third argument.
Copy-Paste IF Statement Examples
Basic pass/fail test
=IF(B2>=60,"Pass","Fail")Returns Pass when the score in B2 is 60 or higher.
Text match
=IF(A2="Paid","Closed","Open")Checks whether a status cell equals a specific word.
Blank cell check
=IF(A2="","Missing","Complete")Useful for validation columns and import checklists.
Greater than target
=IF(C2>D2,"Over budget","OK")Compares actual values against planned values.
Date deadline check
=IF(A2<TODAY(),"Overdue","On time")Flags dates that are earlier than today.
IF with AND
=IF(AND(B2>=60,C2="Yes"),"Eligible","Not eligible")Requires both conditions to be true.
IF with OR
=IF(OR(B2="High",C2>1000),"Review","Normal")Returns Review when at least one condition is true.
Nested IF
=IF(B2>=90,"A",IF(B2>=80,"B",IF(B2>=70,"C","D")))Creates grade bands, but can become hard to maintain.
IF with IFERROR
=IFERROR(IF(A2/B2>1,"High","Low"),"Check input")Handles divide-by-zero or invalid inputs.
Return a blank
=IF(A2="","",A2*B2)Keeps reports clean until required input exists.
IF Statement with Text
Text values must be placed inside double quotes. For example, =IF(A2="Complete","Done","Waiting") is valid. If you write =IF(A2=Complete,...), Excel looks for a named range called Complete and may return a #NAME? error.
IF Statement with Dates
Dates are safer when built with the DATE function: =IF(A2<DATE(2026,7,1),"Old","Current"). Typed date strings can behave differently depending on your regional settings, especially in international workbooks.
Nested IF vs IFS
Nested IF formulas work, but they become hard to audit after three or four conditions. In modern Excel, use IFS for multiple bands where possible. For example: =IFS(B2>=90,"A",B2>=80,"B",B2>=70,"C",TRUE,"D").
Common IF Formula Mistakes
- Forgetting quotes around text results.
- Mixing up comma and semicolon separators in different Excel locales.
- Returning numbers as text, such as
"100"instead of100. - Creating nested formulas that nobody can review later.
- Hiding errors with IFERROR before understanding why the error happened.
Best Practice
Use helper columns for complex logic. A formula split across three readable columns is often safer than one giant IF formula. If the workbook will be shared, audit formulas before sending so overwritten logic, hidden errors, and inconsistent formulas do not spread unnoticed.