Logic and errors function
AND function in Google Sheets and Excel
AND checks several conditions at once and returns TRUE only when every one of them is TRUE.
Checked against Microsoft's and Google's documentation on · Example calculated on a live sheet
- Excel 2016
- Excel 2019
- Excel 2021
- Excel 2024
- Microsoft 365
- Google Sheets
Syntax
AND(logical1, [logical2], ...)Arguments in [brackets] are optional. Google Sheets writes it AND(logical_expression1, [logical_expression2, ...]).
Example
=AND(G2>=F2,E2>C2) reads: Is G2 (the rep's quarter total) at least F2 (the target), and is E2 (September) more than C2 (July)? TRUE only if both are.
| A | B | C | D | E | F | G | H | |
|---|---|---|---|---|---|---|---|---|
| 1 | Rep | Region | Jul | Aug | Sep | Target | Q3 total | Both? |
| 2 | Amara Osei | North | $12,400 | $13,100 | $11,800 | $36,000 | $37,300 | FALSE |
| 3 | Ben Fischer | South | $9,800 | $10,250 | $12,100 | $30,000 | $32,150 | TRUE |
| 4 | Lina Chen | East | $15,200 | $14,800 | $16,900 | $45,000 | $46,900 | TRUE |
| 5 | Diego Alvarez | West | $8,700 | $9,100 | $8,400 | $28,000 | $26,200 | FALSE |
| 6 | Eva Novak | North | $11,200 | $12,600 | $13,900 | $36,000 | $37,700 | TRUE |
| 7 | Farid Haddad | South | $13,300 | $12,900 | $14,100 | $39,000 | $40,300 | TRUE |
| 8 | Grace Kim | East | $10,100 | $9,600 | $10,800 | $33,000 | $30,500 | FALSE |
| 9 | Hugo Martin | West | $14,500 | $15,800 | $15,100 | $42,000 | $45,400 | TRUE |
H6 shows TRUE for Eva: $37,700 beats her $36,000 target and her September ($13,900) beats July ($11,200). Amara's H2 is FALSE: she reached target, but September fell.
How the spreadsheet calculates it
Is TRUE only when all of these are true: G2 is greater than or equal to F2; E2 is greater than C2.
- 1. AND: Is TRUE only when all of these are true:
G2is greater than or equal toF2;E2is greater thanC2.condition1=`G2>=F2`: the first comparisoncondition2=`E2>C2`: the next one. Add as many as you need, separated by commas
More AND examples
=IF(AND(G2>=F2,E2>C2),"Bonus","No bonus")A bonus only when the target is met and sales grew.=AND(C2>=10000,C2<=15000)TRUE when July is between 10,000 and 15,000.=AND(B2="East",C2>12000)East reps with a July above 12,000.=AND(C2<>"",D2<>"",E2<>"")TRUE when all three months are filled in.
Paste any of these into the formula explainer to see it step by step.
Tips
- Write each condition so it reads on its own, then put them inside AND.
- Test AND by itself in a spare column before nesting it in IF, so you can see each TRUE and FALSE.
- For "any of these" use OR; for "none of these" wrap OR in NOT.
What AND is used for
Bonus and commission rules (target met and no drop in sales), validation checks (a date filled in and a status of Shipped), eligibility tests, and the conditions inside IF, conditional formatting and data validation.
Arguments
| Argument | Required | What it is |
|---|---|---|
| logical1 | Yes | The first condition, such as G2>=F2.Watch out: A bare text value like "yes" isn't a condition: compare it, as in C2="yes". |
| logical2, ... | No | Up to 255 conditions in all. If any one is FALSE, AND is FALSE. |
Common mistakes
Writing
G2>=F2 AND E2>C2: there's no AND operator; use the function.Using AND when you mean “either one”: that's OR.
Testing one cell against two different values, like
AND(B2="North",B2="South"): a cell can't be both, so it's always FALSE. That's OR.Writing a between test as
10000<C2<15000: it doesn't mean what it looks like and gives a wrong answer without an error. WriteAND(C2>10000,C2<15000).
In Google Sheets
Google Sheets' AND works the same way; Google calls the arguments logical_expression1, logical_expression2…
Errors you may see with AND
Questions
How do I use AND inside IF?
Make AND the condition: =IF(AND(G2>=F2,E2>C2),"Bonus","No bonus"). See IF with AND and OR.
How do I check if a number is between two values?
Give AND both limits: =AND(C2>=10000,C2<=15000) is TRUE when July is from 10,000 to 15,000, both included. Use > and < to leave the limits out.
Why doesn't AND work inside FILTER or SUMPRODUCT?
AND squeezes everything into one TRUE or FALSE, even when you give it whole columns. To test each row, multiply the conditions instead: (B2:B9="East")*(C2:C9>10000). Use AND for one row at a time.
How do I check that several cells are all filled in?
Combine AND with comparisons: =AND(C2<>"",D2<>"",E2<>"") is TRUE only when all three months have a value.
Sources
Official documentation the facts on this page were checked against.