Advanced Excel Logical - IF Function



Description

The IF function returns one value if a condition is TRUE and another value if it is FALSE.

Syntax

IF (logical_test, value_if_true, [value_if_false]) 

Arguments

Argument Description Required/ Optional
logical_test The condition you want to test. Required
value_if_true The value that you want returned if the result of logical_test is TRUE. Required
value_if_false The value that you want returned if the result of logical_test is FALSE. Optional

Notes

  • IF Function returns an error 0 (zero) in cell, if neither value_if_true nor value_if_false are provided.

  • To see the right value returned, add argument text to the two arguments, or add TRUE or FALSE to the argument.

  • IF Function returns an error #NAME? in cell if the formula is misspelled.

  • IF Function is more useful when nested. Up to 64 IF Functions can be nested with each other for value_if_true and value_if_false arguments to construct more elaborate tests.

  • If any of the arguments to the IF Function are arrays, every element of the array is evaluated when the IF statement is carried out.

  • You can use IF in conjunction with other Excel functions −

    • To count the number of occurrences of a string of text or a number within a range of cells, use the COUNTIF or the COUNTIFS functions.

    • To calculate a sum based on a string of text or a number within a range, use the SUMIF or the SUMIFS functions.

Applicability

Excel 2007, Excel 2010, Excel 2013, Excel 2016

Example

IF Function
advanced_excel_logical_functions.htm
Advertisements