Cellgrids Cellgrids
Home › Practice questions › OR › Question 8

Excel OR Practice Question: Count how many customers are from Pune or Surat (cities in B2:B6) and put the…

By Rinkesh Shah, founder of Cellgrids.

The question

Count how many customers are from Pune or Surat (cities in B2:B6) and put the count in D2.

The data

ABCD
1NameCityCount
2RahulPune?
3PriyaDelhi
4AmitSurat
5NehaPune
6KaranJaipur

The yellow cell is where your answer goes.

Show answer

Answer in D2: 3

How it works

Explanation: Adding the two tests gives an OR for each row (0 means neither, 1 or 2 means at least one). SUMPRODUCT counts the rows where the sum is above 0.
Syntax: =SUMPRODUCT(--(((B2:B6="Pune")+(B2:B6="Surat"))>0))
Rahul and Neha are from Pune, and Amit is from Surat. Priya and Karan are not. The count is 3.

Try it yourself in the live sheet

Type your formula in the highlighted cell and get instant feedback. Free, no Excel install needed.

Try this question in the live sheet →

OR syntax

=OR(logical1, [logical2], ...)

Returns TRUE if at least one condition given is true. OR is used to build decision rules directly into a spreadsheet instead of manually judging each row. Full OR guide.

More OR practice questions

All practice questions · Excel exercises · Interview prep · Cheat sheet