Google Sheets
IF function in Google Sheets
Returns one value if a logical expression is `TRUE` and another if it is `FALSE`.
=IF(logical_expression, value_if_true, value_if_false)IF syntax and parameters
Three arguments, two required.
- logical_expressionbooleanRequired
An expression or reference to a cell containing an expression that represents some logical value, i.e. TRUE or FALSE.
- value_if_trueanyRequired
The value the function returns if logical_expression is TRUE.
- value_if_falseanyOptional
[ OPTIONAL - blank by default ] - The value the function returns if logical_expression is FALSE.
IF examples
Formulas you'll actually reuse.
Label a deal by size:
=IF(D2 > 1000, "Large", "Small")Result
"Large"Three outcomes by nesting — blank, future, or past ship date:
=IF(E2 = "", "Not shipped", IF(E2 > TODAY(), "Scheduled", "Shipped"))Result
"Shipped"
IF in Excel
Same name — your formula ports as-is.
Try IF in the playground
Edit the example — nothing to install.
Preloaded with the IF formula from Example 1 — change anything and watch it respond.
Loading the editor…
Related functions
More ways Google Sheets gets this done.
- ANDReturns true if all of the provided arguments are logically true, and false if any of the provided arguments are logically false.LogicalExcel
- FALSEReturns the logical value `FALSE`.LogicalExcel
- IFERRORReturns the first argument if it is not an error value, otherwise returns the second argument if present, or a blank if the second argument is absent.LogicalExcel
- IFNAEvaluates a value. If the value is an #N/A error, returns the specified value. .LogicalExcel
- IFSEvaluates multiple conditions and returns a value that corresponds to the first true condition.LogicalExcel
- LAMBDACreates and returns a custom function with a set of names and a formula_expression that uses them. To calculate the formula_expression, you can call the returned function with as many values as the name declares.LogicalExcel