Skip to content

How to count with OR conditions in Excel in Excel

Count rows that meet one condition or another with COUNTIF added together, an array constant, or SUMPRODUCT, without double counting.

COUNTIFS combines its conditions with AND: a row must meet all of them. To count rows that meet this or that, you need a different pattern.

When both tests look at the same column, add two COUNTIFs:

=COUNTIF(A2:A13, "Open") + COUNTIF(A2:A13, "Pending")

No row can be both Open and Pending, so nothing is counted twice. A tidier form uses an array constant: =SUM(COUNTIF(A2:A13, {"Open","Pending"})). COUNTIF runs once for each item in the braces and SUM adds the results.

When the tests look at different columns, adding two COUNTIFs can double count. A row in the North region with High priority would be counted once for each test. Count the rows once with SUMPRODUCT:

=SUMPRODUCT(--((B2:B13="North") + (C2:C13="High") > 0))

Each test gives TRUE or FALSE per row. Adding them gives 0, 1 or 2, the > 0 turns that into TRUE for rows meeting at least one test, and the double negative converts TRUE and FALSE to 1 and 0 so SUMPRODUCT can add them.

You can also remove the overlap: count both tests, then subtract the rows that met both with COUNTIFS. =COUNTIF(B,"North")+COUNTIF(C,"High")-COUNTIFS(B,"North",C,"High").

Remember the pitfall: always ask whether any row can meet both tests. If it can, adding is wrong. The Analysis track covers conditional counting with COUNTIFS and SUMPRODUCT.

3 ways to do it

1Add COUNTIFs on the same column

=COUNTIF(A2:A13,"Open")+COUNTIF(A2:A13,"Pending")

  1. Write one COUNTIF per value you want to include.
  2. Add them together. This is safe when one cell cannot match both values.

2Array constant inside SUM

=SUM(COUNTIF(A2:A13,{"Open","Pending"}))

  1. Put the values in braces as the criteria: {"Open","Pending"}.
  2. COUNTIF returns one count per value, and SUM adds them.

3SUMPRODUCT across different columns

=SUMPRODUCT(--((B2:B13="North")+(C2:C13="High")>0))

  1. Write each test as a comparison across its column, and add the comparisons.
  2. Test whether the sum is greater than 0, so a row that meets both tests is counted once.

Try it yourself

Solve it in the sheet. Every answer is checked, with hints if you need them.

Task 1 of 2

In E2, count the rows whose status in A2:A13 is Open or Pending.

Answer in E2.

E2
A
B
C
D
E
F
1
Status
Region
Priority
Open or Pending
2
Open
North
High
3
Closed
South
Low
4
Pending
North
Low
North or High priority
5
Open
West
High
6
On hold
South
High
7
Pending
West
Medium
8
Closed
North
Medium
9
Open
South
Medium
10
Closed
West
Low
11
Pending
South
High
12
Open
North
Low
13
On hold
West
Low

Learn it properly, one graded sheet at a time.

Logic and text covers this in lesson 18, VALUE and text numbers.