ExcelUnpackUnpack Excel, one formula at a time.
Log inSign up

Lesson 71 · Array formulas

Counting with arrays in Excel

SUMPRODUCT can also count. Each test gives 1 or 0 for every row, and SUMPRODUCT adds them up. Multiply two tests to count rows that pass both.

Practice this lesson →Pro lesson. The first 4 lessons are free.

What you will learn

  • Count rows that pass a test with SUMPRODUCT
  • Count rows that pass two tests

How it works

=SUMPRODUCT((C2:C9>500)*1) counts the amounts over 500.

For two tests, multiply them: =SUMPRODUCT((B2:B9="West")*(C2:C9>300)).

Formulas at a glance

=SUMPRODUCT((C2:C9>500)*1)count one test
=SUMPRODUCT((B2:B9="West")*(C2:C9>300))count two tests

Example

Write the formula with SUMPRODUCT to count the orders over 500.

ABCDEF
1OrderRegionAmountStatus
21001West$820.00ShippedOver 500
31002East$240.00PendingWest over 300
41003North$510.00Shipped
51004West$130.00ShippedUnder 400
61005South$975.00PendingEast shipped
71006East$660.00Shipped
81007West$390.00Pending

Click G2 and type =SUMPRODUCT((C2:C9>500)*1), then press Enter.

The answer is 4.

When to use it

  • Counting orders over an amount
  • Counting rows that pass two tests
  • Counts COUNTIFS can’t do

Common mistakes

  • Getting 0 with one testMultiply by 1 to turn TRUE/FALSE into numbers: (C2:C9>500)*1.
  • Ranges of different sizesAll ranges must cover the same rows.
  • Adding tests for ANDMultiply for AND. Add for OR.

Practice it on a real sheet

Reading is a start. Doing it is how it sticks. This lesson walks you through every click on a live spreadsheet and checks each answer.

Counting with arrays in Excel: how it works, with examples · ExcelUnpack