Return value based on given criteria in Excel
Specifies a logical test to perform


Return value based on given criteria


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.


= IF(logical_test, value_if_true, [value_if_false])


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.

Keep Reading Similar Functions:

Evaluates each case and returns the associated variable that matches first.


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.

Read More »
Returns a different result if the first argument evaluates to an error


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.

Read More »
Substitute #N/A error and replace with an alternate value in Excel


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).

Read More »