Author: Oscar Cronquist Article last updated on November 15, 2018

This example sheet has 3 columns with some random data. It is quite complicated trying to manually count unique distinct records from this table but Excel can do that for us.

A record is an entire row in the table below.

Formula in cell B12:


Watch a video where I explain the formula

We can verify the count above in cell B12 by extracting all unique distinct records from the above table. I am using a formula from this blog article:
Filter unique distinct row records in Excel

Explaining formula in cell B12


Step 1 - Count each record in data set

COUNTIFS(C3:C9,C3:C9,D3:D9,D3:D9,E3:E9,E3:E9) counts the number of times all criteria match on each row


The first record is Bike, 1, Color: Blue. The only rows where these criteria match is the first one and last. So the first number in the returning array is 2.

I have entered =COUNTIFS(C3:C9,C3:C9,D3:D9,D3:D9,E3:E9,E3:E9) in column E.

COUNTIFS(C3:C9,C3:C9,D3:D9,D3:D9,E3:E9,E3:E9) returns {2;2;2;2;1;2;2}

Step 2 - Divide 1 with array

Why divide 1 with array? If there are two instances of a value the sum returns 1 (0.5 + 0.5 = 1), three instances returns 1 (1/3 + 1/3 + 1/3 = 1) and so on. This lets you count all instances of a value as one.




and returns {0.5;0.5;0.5;0.5;1;0.5;0.5}

Step 3 - Sum values in array

The SUMPRODUCT function lets you sum values, in this case, without entering it as an array formula.




and returns 4 in cell range B12

Download excel *.xlsx file

Count unique distinct records.xlsx
(Excel 2007 Workbook *.xlsx)

Count records with possible blank rows in data set

Array formula in cell A28:

=SUM(IF((A2:A25="")*(B2:B25="")*(C2:C25="")*(D2:D25=""), 0, 1/COUNTIFS($A$2:$A$25, $A$2:$A$25, $B$2:$B$25, $B$2:$B$25, $C$2:$C$25, $C$2:$C$25, $D$2:$D$25, $D$2:$D$25)))

How to create an array formula

Count blank rows/records 

Formula in B28:


Functions used in this formula:

COUNTIFS(criteria_range1,criteria1, criteria_range2, criteria2...)
Counts the number of cells specified by a given set of conditions or criteria

Adds all the numbers in a range of cells