BBampaa

Lessons › Excel & Google Sheets

Excel & Google Sheets lesson

IF with AND

O101 is from Lagos and worth 70, so both tests pass and the sheet shows Star.

Try this lesson free →
About 5–10 minutes · no sign-up needed

Example

AND is TRUE only when every test inside it is true. Use it as the test inside IF:

=IF(AND(C2="Lagos",F2>50),"Star","Normal")

Typed into cell G2 of this sheet:

OrderDayLocationProductQtyRevenueLabel
O101MonLagosEarbuds270
O102MonAbujaCharger115
O103TueLagosPhone case324
O104WedLagosEarbuds135
O105WedAbujaEarbuds4140
O106ThuLagosCharger230
O107FriAbujaPhone case540
O108FriLagosEarbuds3105

Key points

AND(test1, test2)TRUE only if every test is true.
C2="Lagos"One test: is this cell Lagos? Each test goes inside AND, separated by a comma.
IF(AND(...),"Star","Normal")Put AND where IF's test goes.

Put together: =IF(AND(C2="Lagos",F2>50),"Star","Normal").

Practice

Try each one in your head first, then open the answer.

1. In G3, show Priority if the order is from Abuja AND worth over 100, otherwise Normal.
=IF(AND(C3="Abuja",F3>100),"Priority","Normal")
2. In G4, show Bulk if the quantity is 3 or more AND the order is from Lagos, otherwise Normal.
=IF(AND(E4>=3,C4="Lagos"),"Bulk","Normal")
3. In G6, show Priority if the order is from Abuja AND worth over 100. Otherwise show Normal.
=IF(AND(C6="Abuja",F6>100),"Priority","Normal")
4. In G7, show Check if the order is from Lagos AND has a quantity of 2 or more. Otherwise show OK.
=IF(AND(C7="Lagos",E7>=2),"Check","OK")
5. In G8, show Bulk if the order is from Abuja AND the quantity is 4 or more. Otherwise show Normal.
=IF(AND(C8="Abuja",E8>=4),"Bulk","Normal")

Learn it by doing. This lesson is a short hands-on level on Bampaa: see it work, then build and write it yourself, with instant feedback.

Try this lesson free →
About 5–10 minutes · no sign-up needed