Spreadsheet Practice

How to count new customers per month in Excel

Formula (Excel and Google Sheets)

=SUMPRODUCT(($B$2:$B$15>=E2)*($B$2:$B$15<=EOMONTH(E2,0))*(COUNTIFS($A$2:$A$15,$A$2:$A$15,$B$2:$B$15,"<"&$B$2:$B$15)=0))

Count orders in the month whose customer has no earlier order: =SUMPRODUCT(($B$2:$B$15>=E2)*($B$2:$B$15<=EOMONTH(E2,0))*(COUNTIFS($A$2:$A$15,$A$2:$A$15,$B$2:$B$15,"<"&$B$2:$B$15)=0)).

Result on the example
one result per row in F2, filled down to F4
Works in
Every current version
Google Sheets
Same formula

See it work

The formula is already in F2, filled down to F4. Change any input and the result updates, or edit the formula to experiment.

How it works

The COUNTIFS part asks, for every order, how many orders the same customer placed before that date. A result of 0 marks the customer's first order. The other two tests keep orders inside the month, and SUMPRODUCT counts the rows where all three are true.

January has three first orders (Northwind, Contoso, Fabrikam); Northwind's second January order is not new because an earlier one exists.

=SUMPRODUCT(($B$2:$B$15>=E2)*($B$2:$B$15<=EOMONTH(E2,0))*(COUNTIFS($A$2:$A$15,$A$2:$A$15,$B$2:$B$15,"<"&$B$2:$B$15)=0))

Result3

  1. $B$2:$B$1514 rows × 1 col: 1/4/2026, 1/9/2026, 1/20/2026, 1/28/2026, …

    A range: 14 cells in one column.

  2. E2Jan 2026

    The value in E2.

  3. $B$2:$B$15>=E2{14 rows × 1 col} TRUE, TRUE, TRUE, TRUE, …

    The >= operator tests at least.

  4. EOMONTH(E2,0)1/31/2026 (46053)

    EOMONTH: Last day of the month, months away.

    • start_dateE2Jan 2026
    • months0
  5. $B$2:$B$15<=EOMONTH(E2,0){14 rows × 1 col} TRUE, TRUE, TRUE, TRUE, …

    The <= operator tests at most.

  6. $B$2:$B$15>=E2)*($B$2:$B$15<=EOMONTH(E2,0){14 rows × 1 col} 1, 1, 1, 1, …

    The * operator multiplies.

  7. $A$2:$A$1514 rows × 1 col: "Northwind", "Contoso", "Northwind", "Fabrikam", …

    A range: 14 cells in one column.

  8. "<"&$B$2:$B$15{14 rows × 1 col} "<46026", "<46031", "<46042", "<46050", …

    The & operator joins as text.

  9. COUNTIFS($A$2:$A$15,$A$2:$A$15,$B$2:$B$15,"<"&$B$2:$B$15){14 rows × 1 col} 0, 0, 1, 0, …

    COUNTIFS: Counts rows that meet every condition.

    • criteria_range1$A$2:$A$1514 rows × 1 col: "Northwind", "Contoso", "Northwind", "Fabrikam", …
    • criteria1$A$2:$A$1514 rows × 1 col: "Northwind", "Contoso", "Northwind", "Fabrikam", …
    • criteria_range2$B$2:$B$1514 rows × 1 col: 1/4/2026, 1/9/2026, 1/20/2026, 1/28/2026, …
    • criteria2"<"&$B$2:$B$15{14 rows × 1 col} "<46026", "<46031", "<46042", "<46050", …
  10. COUNTIFS($A$2:$A$15,$A$2:$A$15,$B$2:$B$15,"<"&$B$2:$B$15)=0{14 rows × 1 col} TRUE, TRUE, FALSE, TRUE, …

    The = operator tests whether the two sides are equal.

  11. $B$2:$B$15>=E2)*($B$2:$B$15<=EOMONTH(E2,0))*(COUNTIFS($A$2:$A$15,$A$2:$A$15,$B$2:$B$15,"<"&$B$2:$B$15)=0{14 rows × 1 col} 1, 1, 0, 1, …

    The * operator multiplies.

  12. SUMPRODUCT(($B$2:$B$15>=E2)*($B$2:$B$15<=EOMONTH(E2,0))*(COUNTIFS($A$2:$A$15,$A$2:$A$15,$B$2:$B$15,"<"&$B$2:$B$15)=0))3

    SUMPRODUCT: Multiplies arrays row by row and adds the results.

    • array1$B$2:$B$15>=E2)*($B$2:$B$15<=EOMONTH(E2,0))*(COUNTIFS($A$2:$A$15,$A$2:$A$15,$B$2:$B$15,"<"&$B$2:$B$15)=0{14 rows × 1 col} 1, 1, 0, 1, …

In Google Sheets

The same formula works in Google Sheets: =SUMPRODUCT(($B$2:$B$15>=E2)*($B$2:$B$15<=EOMONTH(E2,0))*(COUNTIFS($A$2:$A$15,$A$2:$A$15,$B$2:$B$15,"<"&$B$2:$B$15)=0)). We ran it in Google Sheets mode on the same data and it returns the same results.

Other ways to do it

Each one was run on the same example sheet.

FormulaResultWhen to use it
=LET(c,UNIQUE($A$2:$A$15),f,MINIFS($B$2:$B$15,$A$2:$A$15,c),SUM((f>=E2)*(f<=EOMONTH(E2,0))))Excel only3, 2, 3Excel 365: finds each customer's first order date with MINIFS, then counts the first dates in the month. Easier to read, and it never counts a customer twice.

Common mistakes

  • If a new customer places two orders on their very first day, the main formula counts both. The LET version counts customers, so it doesn't.
  • Customers who bought before the data starts look new. Include enough history, or a "first order date" from your CRM.

Try it yourself

Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.

Count new customers per month

In F2, count the customers whose first order was in the month starting on E2, then fill down to F4.

Questions

How do I flag each first order with a helper column?

Sort by date and use =COUNTIF($A$2:A2,A2)=1 filled down; TRUE marks a first order. Then COUNTIFS on that column and the month.

How do I count returning customers instead?

Count distinct customers in the month and subtract the new ones.

Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.