formulastreak

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

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.

Q3 sales team · edit H2 and watch it recalculate
Click a cell (or use the arrow keys) to insert its address · Enter shows the resultH2 = FALSE
ABCDEFGH
1RepRegionJulAugSepTargetQ3 totalBoth?
2Amara OseiNorth$12,400$13,100$11,800$36,000$37,300FALSE
3Ben FischerSouth$9,800$10,250$12,100$30,000$32,150TRUE
4Lina ChenEast$15,200$14,800$16,900$45,000$46,900TRUE
5Diego AlvarezWest$8,700$9,100$8,400$28,000$26,200FALSE
6Eva NovakNorth$11,200$12,600$13,900$36,000$37,700TRUE
7Farid HaddadSouth$13,300$12,900$14,100$39,000$40,300TRUE
8Grace KimEast$10,100$9,600$10,800$33,000$30,500FALSE
9Hugo MartinWest$14,500$15,800$15,100$42,000$45,400TRUE

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. 1. AND: Is TRUE only when all of these are true: G2 is greater than or equal to F2; E2 is greater than C2.
    • condition1 = `G2>=F2`: the first comparison
    • condition2 = `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

ArgumentRequiredWhat it is
logical1YesThe 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, ...NoUp 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. Write AND(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

  • #VALUE!: None of the arguments is a condition or a number, for example AND pointing at a range that holds only text. Microsoft documents #VALUE! for a range with no logical values.
  • #NAME?: Text compared without quotes, like `B2=North` instead of `B2="North"`.

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.

Practise AND on a live sheet

Lesson 12, AND and OR (Unit 3, Decisions), has 4 graded exercises, checked instantly, with steps and hints when you're stuck. Pro