Features of !SEMTools
↑ Navigate Excel tasks and !SEMTools add-in features ↑

AND

AND function in Excel - logical condition examples
Basic examples of using the AND function
Function categoryLogical functions
VolatilityNon-volatile
Similar functionsOR — checks if any condition is true
NOT — reverses logical value
IF — performs conditional calculations

What does the AND function do?

The AND function checks whether all provided conditions are TRUE. Returns TRUE only if every condition is met, FALSE if any condition is not met.

It can be used to verify that a series of numbers meets specific conditions, or to check that a number or date falls between upper and lower limits.

Like the OR function, it's typically used in combination with other logical functions, most commonly with the IF function, and with array formulas.

AND function syntax

=AND(logical1, [logical2], ...)
=AND(value_range)
AND: all must be TRUE
E3=AND(A3:C3)
ABCDE
1Value 1Value 2Value 3ANDAND(range)
2TRUETRUETRUETRUE=AND(A2,B2,C2)TRUE=AND(A2:C2)
3TRUEFALSETRUEFALSE=AND(A3,B3,C3)FALSE=AND(A3:C3)
415textTRUE=AND(A4:C4)TRUE=AND(A4:C4)
50TRUETRUEFALSE=AND(A5,B5,C5)FALSE=AND(A5:C5)
6text#VALUE!=AND(A6:C6)#VALUE!=AND(A6:C6)

Any number except 0 counts as TRUE, 0 as FALSE. Text and empty cells inside a range are skipped; if nothing else is left, AND returns #VALUE!.

AND: result and input format

The function correctly processes:

  • Numbers and calculations returning numbers
  • Logical expressions (TRUE, FALSE) and calculations returning them
  • Cells containing these values
  • Cell ranges where at least one cell contains numbers or logical values
  • Arrays of values or calculations

If a range containing text values is provided, they are ignored by the function, as are empty cells.

The function returns an error if:

  • only text or empty cells are provided as input (one or more)
  • there are errors among the values (#VALUE!, #N/A, #NAME?, #NULL!, #DIV/0!, #REF!, #NUM!)

AND formula examples

Example 1

The following example shows a list of test results.

The teacher wants to find students who scored above average on all three exams.

The AND function was used to verify that the score for each subject is above average.

The result TRUE is shown for students who scored above average in all three exams.

Example of using AND function with AVERAGE function
Example of using AND function with AVERAGE function
=AND(B2>=AVERAGE($B$2:$B$11),C2>=AVERAGE($C$2:$C$11),D2>=AVERAGE($D$2:$D$11))
Example 1: above average in every subject
E4=AND(B4>=AVERAGE($B$2:$B$6),C4>=AVERAGE($C$2:$C$6),D4>=AVERAGE($D$2:$D$6))
ABCDE
1StudentMathPhysicsEnglishAll above average?
2Ann827590FALSE=AND(B2>=AVERAGE($B$2:$B$6),C2>=AVERAGE($C$2:$C$6),D2>=AVERAGE($D$2:$D$6))
3Bob608870FALSE=AND(B3>=AVERAGE($B$2:$B$6),C3>=AVERAGE($C$2:$C$6),D3>=AVERAGE($D$2:$D$6))
4Cleo919385TRUE=AND(B4>=AVERAGE($B$2:$B$6),C4>=AVERAGE($C$2:$C$6),D4>=AVERAGE($D$2:$D$6))
5Dan706560FALSE=AND(B5>=AVERAGE($B$2:$B$6),C5>=AVERAGE($C$2:$C$6),D5>=AVERAGE($D$2:$D$6))
6Eve888079FALSE=AND(B6>=AVERAGE($B$2:$B$6),C6>=AVERAGE($C$2:$C$6),D6>=AVERAGE($D$2:$D$6))
7Average78.2=AVERAGE(B2:B6)80.2=AVERAGE(C2:C6)76.8=AVERAGE(D2:D6)

Each condition compares a score with its column average; AND returns TRUE only when all three hold. Eve is above average in Math and English but just below in Physics (80 < 80.2).

Example 2

Parents are choosing a girl's name and want the name to contain all three letters they like.

Excel doesn't allow filtering rows by more than two criteria, but for this task we can use an array formula with the AND function in combination with the SEARCH function and ISNUMBER.

Note that for the function to check for the presence of all letters, this must be an array formula. It should be entered without curly braces, but the cell entry should be completed using Ctrl + Shift + Enter.

{=AND(ISNUMBER(SEARCH(C$2:C$4,$A11)))}
Example 2: names that contain all three letters
B2=AND(ISNUMBER(SEARCH($D$2:$D$4,A2)))
ABCD
1NameHas l, i, a?Letters
2AmeliaTRUE=AND(ISNUMBER(SEARCH($D$2:$D$4,A2)))l
3OliviaTRUE=AND(ISNUMBER(SEARCH($D$2:$D$4,A3)))i
4IsabellaTRUE=AND(ISNUMBER(SEARCH($D$2:$D$4,A4)))a
5EmilyFALSE=AND(ISNUMBER(SEARCH($D$2:$D$4,A5)))
6LilyFALSE=AND(ISNUMBER(SEARCH($D$2:$D$4,A6)))

SEARCH looks for each letter from D2:D4 and returns three positions or errors; ISNUMBER turns them into TRUE/FALSE, and AND requires all three. “Emily” has no “a”. In Excel 365 no Ctrl+Shift+Enter is needed.

The exact formula is highlighted in the screenshot. It determines whether the name contains all three letters:

AND function in Excel - array formula example
Example of using AND function in array formula

In column H, the OR function was useful - it passes names if they contain TRUE for at least one of the letter sets.

Other Logical functions in Excel

IF, OR, NOT, TRUE, FALSE, IFERROR, IFS, SWITCH, XOR

Like the article? Help its author! Buy !SEMTools, it has lots of useful instruments to process text data.