# IF

## Rational

Return value based on given criteria

## Description

The Excel IF function is a handy logical operator that return value based on a valid test of criteria, if it matches (TRUE) and another value if it does not.

## Syntax

= IF(logical_test, value_if_true, [value_if_false])

## Parameters

logical_test – The criteria to evaluate.
value_if_true [optional] – The value to return if criteria match (TRUE).
value_if_false – [optional] – The value to return if criteria does not match (FALSE).

## Return Value

Value based on the optional argument

## Key Notes

The IF function can test an argument (logical_test) and return the corresponding value of TRUE or FALSE logic, unlike IFS function that can evaluate multiple logics at once but limited to one FALSE argument.

For Example, if a teacher wants to check that students are pass or fail when the minimum passing mark is 50.

IF function may be used to verify such logic,

=IF(B5>50, “Pass”,”Fail”)

So, the logical test is ‘B5>50’ if the cell value of B5 is higher than 50 (TRUE) then function return Pass otherwise Fail.

IF function allows returning a blank result that can easily get substituted with another formula.
Returns #N/A error if none of the logic tests is TRUE.

### IFNA

The IFNA function evaluate given criterion (value) in case the return value is a #N/A error then it substitutes with a different text string (value_if_na).

### SWITCH

The Excel SWITCH function lookup value in a list of multiple labels and return the corresponding first match otherwise default clause or #N/A return.

### IFERROR

How to change the Excel formula result like #DIV, #VALUE!, #REF!, #NAME?, #NUM! by another value like string, blank, and zero with the IFERROR function.