FormulaCamp
Completed
← Google Sheets functions
Google Sheets function

IF in Google Sheets

To apply IF to every row from one cell in Google Sheets, wrap it: ARRAYFORMULA(IF(B2:B10>=70,"Pass","Fail")).

Syntax (same in Google Sheets)

IF(logical_test, [value_if_true], [value_if_false])

Without ARRAYFORMULA, IF looks only at the first cell of a range.

For a fuller explanation of the arguments and common errors, see the IF Excel guide.

Worked examples in Google Sheets

Pass or fail

AB
1StudentScore
2Ana72

Formula: D2: =IF(B2>=70,"Pass","Fail")

Result: Pass

72 is at least 70, so the true branch is returned. Text results go in quotes.

Nested IF for letter grades

AB
1StudentScore
2Ben84

Formula: D2: =IF(B2>=90,"A",IF(B2>=80,"B","C"))

Result: B

The second IF sits in the false branch of the first. For more than three outcomes prefer IFS.

Two conditions with AND

ABC
1NameAgeMember
2Cara21Yes

Formula: E2: =IF(AND(B2>=18,C2="Yes"),"Eligible","Not eligible")

Result: Eligible

AND is true only when both tests are true. Use OR when one is enough.

Try it

A tiny spreadsheet with example data. Edit the formula or any number and see the result.

Formula in F2: =IF(B2>=60,"Pass","Fail")

Example spreadsheet for IF
ABCDEF
1StudentScoreExtra creditAttemptsResult
2Ann92Yes2Pass
3Bob74No0
4Cy58Yes3
5Dee81No1
6Eli662
Result in F2: Pass
Practice this in a lesson: Nested IF and IFS

Frequently asked questions

How do I fill an IF formula down a whole column at once in Google Sheets?
Put the formula in the first result cell inside ARRAYFORMULA and give it the full range. One cell then produces the whole column.

Google Sheets is used here only as a descriptive product name. FormulaCamp is not affiliated with Google.