Count Distinct Clients by Criteria in Excel 2016
Question details
Count each client once when their interactions meet a date range, team, and interaction type.

- Product
- Microsoft Excel 2016
- Device & OS
- not provided
- Scenario
- A summary already uses COUNTIFS to count interactions and needs a separate count of distinct clients using the same criteria.
- Observed behavior
- The desired result is one count per qualifying client, even when that client has multiple matching interactions.
Identify the client ID, date, team, and interaction type columns, and make sure the dates are stored as Excel dates. The examples use Data!B2:E5000, start and end dates in Sheet1!D1:D2, the team in Sheet1!A6, and the interaction type in Sheet1!B5.
Use an array formula to count qualifying clients once
Use this formula in a summary cell when you want a distinct client count without adding a helper column.
The formula assigns each qualifying interaction a fraction based on the number of matching interactions for that client. Those fractions add up to one per client. The end-date condition includes the entire calendar day, including timestamps.
The example excludes blank client IDs. It assumes client IDs do not contain COUNTIFS wildcard characters such as * or ?.
Select the summary cell on Sheet1 and enter: =SUM(IF((Data!$B$2:$B$5000<>"")*(Data!$C$2:$C$5000>=Sheet1!$D$1)*(Data!$C$2:$C$5000<Sheet1!$D$2+1)*(Data!$D$2:$D$5000=Sheet1!$A6)*(Data!$E$2:$E$5000=Sheet1!B$5),IFERROR(1/COUNTIFS(Data!$B$2:$B$5000,Data!$B$2:$B$5000,Data!$C$2:$C$5000,">="&Sheet1!$D$1,Data!$C$2:$C$5000,"<"&(Sheet1!$D$2+1),Data!$D$2:$D$5000,Sheet1!$A6,Data!$E$2:$E$5000,Sheet1!B$5),0),0))
Press Ctrl+Shift+Enter instead of Enter in Excel 2016. Excel displays braces around the formula; do not type them yourself.
Replace the example columns and row limits with your data ranges, keeping all ranges the same size. Copy the summary cell across or down if the team and interaction type references match your layout.

Count distinct clients with a WPS Spreadsheet helper column
Use a helper column in WPS Spreadsheet to mark the first qualifying interaction for each client, then sum those markers for a distinct count.
- 1. Open the workbook: Open your Excel workbook in WPS Spreadsheet. On Sheet1, enter the start date in D1, the end date in D2, the team in A6, and the interaction type in B5.
- 2. Add a helper formula: On the Data sheet, enter this formula in F2: =IF(AND(B2<>"",C2>=Sheet1!$D$1,C2<Sheet1!$D$2+1,D2=Sheet1!$A$6,E2=Sheet1!$B$5),IF(COUNTIFS($B$2:B2,B2,$C$2:C2,">="&Sheet1!$D$1,$C$2:C2,"<"&(Sheet1!$D$2+1),$D$2:D2,Sheet1!$A$6,$E$2:E2,Sheet1!$B$5)=1,1,0),0)
- 3. Fill the helper column: Drag the fill handle from Data!F2 down through the last data row. Each qualifying client receives one marker for the selected criteria.
- 4. Sum the markers: In a summary cell, enter =SUM(Data!F2:F5000), adjusting the last row to match your data. Use a separate helper column with adjusted criteria references for each team and interaction type combination.

Frequently Asked Questions
Why does COUNTIFS count a client more than once?
COUNTIFS counts matching rows, not unique client IDs. If a client has several qualifying interactions, each matching row contributes to the total.
How do I enter the distinct-count formula in Excel 2016?
Select the summary cell, paste the array formula, and press Ctrl+Shift+Enter. Do not type the braces that Excel displays around the formula.
Does the formula include interactions on the end date?
Yes. The condition using a date earlier than D2+1 includes the whole end date, including times. Enter a calendar date without a time in Sheet1!D2.
Are blank client IDs included in the count?
No. Both examples check that the client ID cell is not blank before counting it.
Why is the array formula slow?
The formula compares client IDs across the selected ranges. Limit all ranges to the rows you need, such as rows 2 through 5000, instead of using entire columns.




