The IF function in Google Sheets returns one value when a test is TRUE and another when it's FALSE, written as =IF(logical_expression, value_if_true, value_if_false). If you've got several conditions, IFS checks them in order and returns the value for the first one that's true, and AND, OR, NOT or XOR go inside the test when one condition isn't enough.
Here's the catch. Google's own help says the single most common source of problems with IF is putting value_if_true and value_if_false in the wrong order. The second argument is what you get when the test passes, the third is what you get when it fails. And that third argument is optional: leave it out and a FALSE test gives you a blank cell, not an error, which is easy to mistake for a broken formula.
What each IF argument does
| Argument | What it's for | Required? |
|---|---|---|
| logical_expression | An expression, or a reference to a cell containing one, that represents TRUE or FALSE | Yes |
| value_if_true | The value IF returns when logical_expression is TRUE | Yes |
| value_if_false | The value IF returns when logical_expression is FALSE | No, it's blank by default |
Google's three sample formulas show how flexible the test can be. IF(A2 = "foo","A2 is foo") returns the text A2 is foo when the cell matches, and a blank when it doesn't, because there's no third argument. IF(A2,"A2 was true","A2 was false") uses the cell itself as the test, with no comparison at all. And IF(TRUE,4,5) simply returns 4.
Writing an IF formula in four moves
- Start with the test. Write the comparison you want to check, such as A2 = "foo", or point at a cell that already holds TRUE or FALSE.
- Add the result for a pass. This is the second argument, value_if_true.
- Decide what a fail should show. Add value_if_false as the third argument, or leave it out if a blank cell is what you want.
- Read it back in order: test, then true, then false. If the results look reversed, the two values are swapped, which is the mistake Google flags most.
Six logic functions side by side
| Function | What it returns | Example from Google's help, as of October 2026 |
|---|---|---|
| IF | One value if the test is TRUE, another if it's FALSE | IF(TRUE,4,5) returns 4 |
| IFS | The value for the first true condition, or #N/A if every condition is FALSE | IFS(A1>90, "A", A1>80, "B", A1>70, "C") |
| AND | TRUE only if every argument is logically true | AND(A2 = "foo", A3 = "bar") |
| OR | TRUE if any argument is logically true | OR(A2 = "foo", A3 = "bar") |
| NOT | The opposite of a logical value | NOT(TRUE) returns FALSE |
| XOR | TRUE if an odd number of arguments are true | XOR(TRUE, FALSE, TRUE) |
AND, OR and XOR all accept ranges as well as single values, so AND(A1:A10,B1:B10) checks every cell in both ranges at once. They also treat numbers the same way: the number 0 is logically false, and every other number, including negative numbers, is logically true. That's why AND(0,1,2,3) returns FALSE because of the 0, while OR(0,1,2,3) returns TRUE.
Grading scores with IFS instead of nested IFs
IFS replaces the old habit of stacking one IF inside another. You list a condition, then the value it should return, then the next condition and its value, and Sheets stops at the first one that's true. Here's Google's own grading example:
| Score | Formula | Result |
|---|---|---|
| 88 | =IFS(A2 > 90, "A", A2 > 80, "B") | B |
| 92 | =IFS(A3 > 90, "A", A3 > 80, "B") | A |
| 65 | =IFS(A4 > 90, "A", A4 > 80, "B") | #N/A |
The 65 is the lesson. Neither condition is true, and when all conditions are FALSE, IFS returns #N/A rather than a blank. So give every case your data can hit its own condition, or wrap the formula in IFERROR, which Google lists right next to IF: it returns the first argument if it isn't an error value, otherwise the second argument if present, or a blank if the second argument is absent.
Google also points to three relatives worth knowing. SWITCH tests an expression against a list of cases and returns the value of the first match, with an optional default. MAXIFS and MINIFS return the largest or smallest value in a range filtered by a set of criteria, which saves you building an IF just to pick out a top or bottom number.
Putting AND and OR inside the test
Because logical_expression can be any expression that represents TRUE or FALSE, you can drop AND or OR straight into it. IF(AND(A2 = "foo", A3 = "bar"), "Both match", "Not both") only passes when both cells match. Swap AND for OR and it passes when either one does. If you're counting how many rows meet a condition rather than labelling each one, COUNTIF in Google Sheets is the shorter route.
Why NOT and XOR catch people out
NOT flips a value, so NOT(TRUE) returns FALSE and NOT(FALSE) returns TRUE. It also works on numbers, using the same rule: NOT(0) returns TRUE and NOT(6) returns FALSE. The trap is text. When a non-numeric value goes into NOT, it returns the error #VALUE!, not TRUE or FALSE. Google's sample NOT(ISERR(A2)) shows the safer pattern of wrapping a check that already returns TRUE or FALSE.
XOR is the one most people haven't met. It returns TRUE only when an odd number of its arguments are true, so two TRUE values cancel each other out. Google's worked table makes it clear:
Want AI doing the heavy lifting in your marketing?
I build the systems that handle the boring 80 percent, so you get your week back. Done properly, with the human kept in.
| First value | Second value | XOR result |
|---|---|---|
| TRUE | FALSE | TRUE |
| FALSE | FALSE | FALSE |
| TRUE | TRUE | FALSE |
| 0 | 1 | TRUE |
| 1 | 5 | FALSE |
The last row surprises people: 1 and 5 are both logically true, that's two trues, so XOR returns FALSE. On its own, XOR(-3) returns TRUE, because a negative number counts as true.
Where I'd start with logic formulas
I'd write the plain IF first and read it back as test, true, false before anything else, because that order is where most IF formulas go wrong. Once you need more than two outcomes, I'd reach for IFS rather than nesting, and I'd always plan for the row that matches nothing so you don't end up staring at #N/A. Keep NOT away from text cells. And if you want the result to change how a cell looks rather than what it says, conditional formatting in Google Sheets uses the same kind of true or false rule.
Frequently asked questions
What does the IF function return if I leave out the third argument?
value_if_false is optional and blank by default, so a FALSE test returns a blank cell instead of an error.
What's the most common mistake with IF in Google Sheets?
Google says it's putting value_if_true and value_if_false in the wrong order. The value for a TRUE test always comes second.
Why does my IFS formula show #N/A?
IFS returns #N/A when all of its conditions are FALSE, so the value didn't match any condition you listed.
Does NOT work on text in Google Sheets?
No. NOT(0) returns TRUE and NOT(6) returns FALSE, but when non-numeric values are input into NOT, the function returns the error #VALUE!.
How does XOR differ from OR?
OR returns TRUE if any argument is true. XOR returns TRUE only if an odd number of the arguments are true, so two TRUE values give FALSE.
