Written by Allen Wyatt (last updated October 17, 2020)
This tip applies to Excel 97, 2000, 2002, and 2003
John has a worksheet that he uses for registration of attendees at a conference. Column A has a list of each person attending, and column B has the company represented by each attendee. Each company can have multiple people attend. John can easily figure out how many individuals are coming to the conference; it is simply the number of rows in column A (minus any header rows). The more difficult task is to determine how many companies are going to be represented at the conference.
There are a couple of ways to determine the desired count. First, if there are no blank cells in column B, you can use an array formula (entered by Ctrl+Shift+Enter) such as the following:
=SUM(1/COUNTIF(B2:B50,B2:B50))
If there are blanks in the range (B2:B50 in this case), then the array formula will return a #DIV/0! error. If that case, the array formula needs to be changed to the following:
=SUM(IF(FREQUENCY(IF(LEN(B2:B50)>0,MATCH(B2:B50,B1:B50,0), ""),IF(LEN(B2:B50)>0,MATCH(B2:B50,B2:B50,0),""))>0,1))
If you prefer to not use an array formula, you can add regular formulas to column C to do the count. First, sort the table of data by the contents of column B. That way the data will be in company order. Then add a formula such as the following to cell C2 (assuming you have a header in row 1):
=IF(B2<>B3,1,0)
Copy the formula down through all the rest of the cells in column C, and then do a sum on the column. The sum represents the number of unique companies attending, since a 1 only appears in column C when the companies change.
Of course, if you need to find the names of all the companies represented at the conference, you can use Excel's filtering capabilities. Follow these steps:
Figure 1. The Advanced Filter dialog box.
You now can easily see how many companies are being represented, along with who those companies are.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (3105) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Getting a Count of Unique Names.
Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!
If you have a list of data in a column, you may want to determine an average of whatever the last few items are in the ...
Discover MoreA moving average can be a great way to analyze a series of data points that you've collected over time. Setting up a ...
Discover MoreYou can use some of Excel's worksheet functions across a range or worksheets, but not all of them. One that has problems ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2020-10-19 11:55:28
Michael J Attea
Also helpful to insert a column, and use the formula if (countifs(C$2:C3)=1,sum(1,count(B$2:B2)),"") and have a max of it above. then you can use that as an automatic listing of unique entries elsewhere like on another sheet, that references that as a lookup and can be used in other reports etc with calculations like sumifs etc which outperforms pivot tables in terms of seamless usage by others.
Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2025 Sharon Parq Associates, Inc.
Comments