Excel
IF function in Excel
Specifies a logical test to perform
=IF(logical_test, value_if_true, [value_if_false])IF syntax and parameters
Three arguments, two required.
- logical_testbooleanRequired
The condition you want to test.
- value_if_trueanyRequired
The value that you want returned if the result of logical_test is TRUE.
- value_if_falseanyOptional
The value that you want returned if the result of logical_test 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 Google Sheets
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 Excel gets this done.
- ANDReturns TRUE if all of its arguments are TRUELogicalGoogle Sheets
- BYCOLApplies a LAMBDA to each column and returns an array of the resultsLogicalGoogle Sheets
- BYROWApplies a LAMBDA to each row and returns an array of the resultsLogicalGoogle Sheets
- FALSEReturns the logical value FALSELogicalGoogle Sheets
- IFERRORReturns a value you specify if a formula evaluates to an error; otherwise, returns the result of the formulaLogicalGoogle Sheets
- IFNAReturns the value you specify if the expression resolves to #N/A, otherwise returns the result of the expressionLogicalGoogle Sheets