Confident CellsExcel practice Start free

AND and OR in Excel: two conditions in one IF

Updated 26 November 2026 · 4 min read

AND gives TRUE only when every test is true. OR gives TRUE when at least one is. On their own they just say TRUE or FALSE, so they usually go inside IF: =IF(AND(B2>=95%,C2>=20000),"Bonus","No bonus"). AND, OR and NOT work in every version of Excel, on Windows and Mac, and in Excel for the web.

AND, OR, NOT and XOR at a glance

FunctionGives TRUE whenExample
ANDEvery test is true=IF(AND(B2>=95%,C2>=20000),"Bonus","No bonus")
ORAt least one test is true=IF(OR(C2>3,B2<90%),"Check","")
AND, for "between"A number is inside a range=AND(B2>=10,B2<=20)
NOTThe test is false=NOT(D2="Paid")
XORExactly one of two tests is true=XOR(B2="Yes",C2="Yes")

Each one is worked through below.

A worked example: AND

A bonus goes to anyone with attendance of 95% or more and sales of at least £20,000.

=IF(AND(B2>=95%,C2>=20000),"Bonus","No bonus")
ABCDE
1NameAttendanceSalesANDBonus?
2Asha97%£21,500.00TRUEBonus
3Ben96%£18,000.00FALSENo bonus
4Cleo95%£24,000.00TRUEBonus
5Dan92%£26,000.00FALSENo bonus
D2 holds =AND(B2>=95%,C2>=20000) on its own, and E2 holds =IF(AND(B2>=95%,C2>=20000),"Bonus","No bonus"). Both are copied down.

Read the IF from the inside out. AND works out TRUE or FALSE first, as column D shows, then IF turns TRUE into "Bonus" and FALSE into "No bonus".

OR: any one is enough

A manager wants to check anyone who has been late more than 3 times or whose attendance is under 90%. One of the two is enough:

=IF(OR(C2>3,B2<90%),"Check","")
ABCD
1NameAttendanceTimes lateCheck?
2Eve98%5Check
3Fin88%1Check
4Gus94%2
5Hana85%6Check
D2 holds =IF(OR(C2>3,B2<90%),"Check",""), copied down. Gus is inside both limits, so D4 is left blank.

Eve has been late 5 times with 98% attendance, so Check. Fin has been late once with 88%, so Check. Gus, late twice with 94%, passes both tests, so D4 gets the empty text "", which looks blank. Hana fails both, and one is enough, so Check.

A number between two others

"Between 10 and 20" is two tests, so it needs AND: is it at least 10, and is it at most 20? An order of 15 boxes is both, so TRUE. An order of 25 is at least 10 but more than 20, so FALSE. Decide whether 10 and 20 themselves count, and use >= and <= if they do.

ABCD
1OrderBoxesMedium order?Band
2A-0115TRUEMedium
3A-0225FALSELarge
4A-0310TRUEMedium
5A-046FALSESmall
C2 holds =AND(B2>=10,B2<=20), and D2 holds =IF(AND(B2>=10,B2<=20),"Medium",IF(B2>20,"Large","Small")). Both are copied down. 10 counts as Medium because of >=.

NOT and XOR

NOT turns TRUE into FALSE and FALSE into TRUE. =NOT(D2="Paid") is TRUE for anything that isn't Paid, the same as D2<>"Paid", which is usually easier to read. NOT is handy round a longer test, such as =NOT(ISNUMBER(SEARCH("refund",B2))) for notes that don't mention a refund.

XOR is TRUE when exactly one of the two tests is true, and FALSE when both are or neither is. Every invoice needs two sign-offs, the manager's and finance's. Those with just one need chasing:

ABCDE
1InvoiceManagerFinanceExactly one?Status
2INV-1YesYesFALSEDone
3INV-2YesNoTRUEChase
4INV-3NoYesTRUEChase
5INV-4NoNoFALSENot started
D2 holds =XOR(B2="Yes",C2="Yes"), copied down. E2 checks AND first (both signed), then XOR (just one): =IF(AND(B2="Yes",C2="Yes"),"Done",IF(XOR(B2="Yes",C2="Yes"),"Chase","Not started")).

XOR is in Excel 2013 and later. In older Excel, B2<>C2 does the same job here, because the two cells only ever hold Yes or No.

AND and OR in other functions

Common mistakes

Typing AND between the tests

=IF(B2>=95% AND C2>=20000,"Bonus","No bonus") reads well but Excel won't accept it. AND goes first, with the tests inside its brackets.

OR(B2="Red","Blue")

The second test has nothing to compare with, so Excel gives #VALUE!. Write each test in full: =OR(B2="Red",B2="Blue").

95 instead of 95%

A cell showing 95% holds 0.95. B2>=95 asks whether 0.95 is at least 95, which it never is, so everyone gets No bonus. Type 95% or 0.95.

AND when you meant OR

"Check anyone late more than 3 times or under 90%" needs OR. With AND, only people who are both get checked. Say the rule out loud with "and" or "or", and use the word you said.

> when the rule says "or more"

"95% or more" includes 95% itself, so it's >=. With >, someone on exactly 95% misses out.

Try it now

Your turn

A bonus goes to anyone with attendance of 95% or more and sales of at least £20,000. In D2, show "Bonus" or "No bonus". Your formula will be copied down to D9.

ABCD
1NameAttendanceSalesBonus?
2Asha97%£21,500.00
3Ben96%£18,000.00
4Cleo95%£24,000.00
5Dan92%£26,000.00
6Ema99%£20,000.00
7Finn94%£19,500.00
8Gail98%£31,000.00
9Hari96%£19,999.00

Open this in Try a formula: the same sheet with the answer filled in, to change or share by link.

Part of IF and COUNTIF practice: every lesson on the topic, with a project in Excel.

Where it works

AND, OR and NOT work in every version of Excel, on Windows and Mac, and in Excel for the web. XOR needs Excel 2013 or later.

Questions

How do I use IF with AND in Excel?

Put AND inside the IF as its test, with each condition inside AND's brackets: =IF(AND(B2>=95%,C2>=20000),"Bonus","No bonus"). AND gives TRUE only when every condition is true, and IF shows the first result for TRUE and the second for FALSE. You can list up to 255 conditions, separated by commas, and mix numbers, text and dates.

How do I use IF with OR in Excel?

Put OR inside the IF as its test: =IF(OR(C2>3,B2<90%),"Check",""). OR gives TRUE when at least one of the conditions is true, so the row gets Check if either one applies. Write each condition in full: OR(B2="Red",B2="Blue") works, and OR(B2="Red","Blue") gives a #VALUE! error.

Can I use AND and OR together?

Yes: put one inside the other. A bonus for anyone with 95% attendance who also has either £20,000 of sales or a top review is =IF(AND(B2>=95%,OR(C2>=20000,D2="Top")),"Bonus","No bonus"). Work from the inside out: OR first, then AND, then IF. Say the rule in words first, and check where each "and" and "or" belongs.

What is the XOR function in Excel?

XOR means "exclusive or". With two tests it gives TRUE when exactly one of them is true, and FALSE when both are or neither is. =XOR(B2="Yes",C2="Yes") finds the rows where only one person has signed something off. With more than two tests it gives TRUE when an odd number of them are true. XOR needs Excel 2013 or later.