IF Function in Excel and Google Sheet

Summary

The IF function checks whether a condition is met, and returns one value if true and another value if false. For example, to "pass" scores above 70: =IF(A1>70,"Pass","Fail"). Can use one more, “IF” again to add more than one condition such like, grade system, A+ for 90 and above score, A for 80 and above, B+ for 70 and etc.

Purpose

Results for Pass or Fail / True or False

Grading / Class

Test for a specific condition

Return value

Returns

The IF function returns value_if_true when the condition is TRUE.

The IF function returns value_if_false when the condition is FALSE.

The IF function returns FALSE if the value_if_false parameter is omitted and the condition is FALSE.

Version

Excel for Office 365, Excel 2019, Excel 2016, Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000

Function Type

Worksheet function (WS)

Syntax

=IF (logical_test, [value_if_true], [value_if_false]) for instance =IF(A1>70,"Pass","Fail")

IF for Function

A1 for Cell Identity

>for Greater than

70 for Pass or score

Pass or Fail for Result

In this example John is failed, because he is required to score above 70 points, its means must be above 70, for instance 70.1, 70.5, 98, 86, these all are above 70, and will be passed if he scored such one, but he scored 70 only meanwhile, the requirement is above 70.

Note: This condition (on example) is not included match or equal to "=" but only grater than.

Let us look at equal to or greater than (>=)


=IF(A1>=70,"Pass","Fail")

Here, two conditions are applied in same function, one of them for greater than and other for equal to. In this example John is passed, his points  are reached 70 and passed, because condition is greater than or equal to 70.