IF

Every question on this hub is the same function with a different comparison inside it; what changes is how many conditions must be weighed at once. One condition with two outcomes needs nothing else. Several that must all hold take AND inside the test, any-one-of-several takes OR, and a run of ordered bands wants nesting — or IFS, where the version allows it. Checking whether a cell contains text rather than equals it needs a helper, because neither Excel nor Google Sheets has a contains operator at all. A test that can error out has to be wrapped before it is asked. Choose below by the shape of the condition, not by the function name.

The formula

=IF(B2>=60,"Pass","Fail")one condition, two outcomes=IF(ISBLANK(B2),"Missing",B2)test for a blank cell=IF(ISNUMBER(SEARCH("urgent",B2)),"Flag","")test if a cell contains specific text=IF(AND(B2>=60,C2="Submitted"),"Pass","Review")every condition must be true=IFERROR(IF(B2>=60,"Pass","Fail"),"Check input") fall back to a value instead of an error

A worked example

B2 holds a test score of 72, and the pass mark is 60.

=IF(B2>=60,"Pass","Fail")

"Pass" — text, not a number, so it left-aligns in the cell. The quotes around Pass and Fail are what make them literal text instead of formula errors; drop them and Excel looks for cells or names called Pass and Fail.

Which one do I need?

If you want to…Use
One condition, exactly two outcomes=IF(condition, value_if_true, value_if_false)
A few ordered conditions where each check only matters once the earlier ones fail (grade bands, tiered pricing)Nested IF: =IF(cond1,res1,IF(cond2,res2,res3)) — modern Excel allows up to 64 levels, but readability breaks down long before that
Many ordered conditions and nesting is getting hard to read=IFS(cond1,res1,cond2,res2,...,TRUE,fallback) — Excel 2019, 2021 and 365 only (not 2016 or earlier); current Google Sheets has it too. Returns #N/A if nothing matches and there is no final TRUE fallback
Every one of several conditions must be true at once=IF(AND(cond1,cond2), true_result, false_result)
Any one of several conditions is enough on its own=IF(OR(cond1,cond2), true_result, false_result)
The condition itself might error out (a lookup, a division) before IF can even test itWrap the whole thing: =IFERROR(IF(...), "fallback")

Frequently asked questions

Why does my IF formula return FALSE instead of a blank cell?

value_if_false was left out. IF then returns the boolean FALSE for a failed test rather than an empty string. Supply it explicitly for a blank-looking result: =IF(B2>=60,"Pass","") shows nothing instead of FALSE when B2 is under 60.

How do I test if a cell contains specific text, not just equals it?

=B2="urgent" only matches a cell that holds exactly that word and nothing else. To match text anywhere inside the cell, wrap SEARCH in ISNUMBER: =IF(ISNUMBER(SEARCH("urgent",B2)),"Flag","") returns "Flag" for any cell containing "urgent", case-insensitive.

Does IF work the same in Google Sheets?

Yes — IF(logical_expression, value_if_true, value_if_false) takes the same three arguments in the same order and behaves identically. IFS is also available in current Google Sheets, without the version gating Excel has (2019/2021/365 only).

Why does IFS return a #N/A error instead of a result?

IFS checks its conditions in order and stops at the first TRUE one; if none of them are true, it has nothing to return and shows #N/A. Add a final catch-all pair — IFS(cond1,res1,cond2,res2,TRUE,"fallback") — so there's always a match.

How to Use IF Function in ExcelMultiple IF Then Statements in ExcelExcel IF Cell Contains TextIF Function Excel - Multiple ConditionsIF Cell Is BlankIF Then ElseExcel Formula IF Cell Contains Specific TextExcel IF Cell Is EmptyExcel IF Statement with Multiple ConditionsCOUNT IF Formula in ExcelHow to Make an IF Statement in ExcelHow to Use IF Statement in ExcelExcel COUNT IF Cell Contains TextExcel Check IF Value Exists in RangeMultiple IF Then ExcelExcel IF Cell Is Not BlankExcel IF Cell Contains Text Then Copy Cell BesideExcel Check IF Cell Contains TextExcel Check IF Cell Is EmptyExcel IF Cell Not EmptyExcel IF Then Statements with Time Text FormatHow to Use an IF Then Statement in ExcelHow to Write IF Formula in ExcelExcel IF Cell Contains Text Then Return ValueExcel IF Formula with TextHow Do I Write an IF Then Formula in ExcelHow to Use IF Then in ExcelExcel Function IF BlankExcel IF Cell Contains Certain TextExcel IF Value Exists in ColumnExcel IF Then Formula with Multiple ConditionsCreating IF Then Statements in ExcelHow to Create IF Then in ExcelHow to Use IF Else in ExcelMultiple IF Formula in ExcelHow to Put IF Formula in ExcelExcel IF Statement with TextCOUNT IF Blank in ExcelCOUNT IF Cell Color ExcelIF Statement with Two Conditions ExcelExcel IF Function with DatesExcel IF Then Date FormulaHow Does IF Function Work in ExcelExcel IF Value Is Between Two NumbersIF Then Statement in Excel with Multiple ConditionsExcel IF Statement with DateExcel MAX IF FunctionExcel IF Value Is in List