Skip to main content

Kutools for Office — One Suite. Five Tools. Get More Done.

How to count unique values with multiple criteria in Excel?

Author Sun Last modified

Here's a range of data with duplicate names, projects, and locations. I've provided the project and location criteria, and your task is to identify which names match the criteria and count the number of unique names, as shown in the screenshot below. Do you have any tips for solving this? In this article, I'll share the methods to help you accomplish this.
A screenshot showing a range of data with names, projects, and locations in Excel

Count unique values with multiple criteria with formulas

Count unique values with multiple criteria with Kutools for Excel good idea3


Count unique values with multiple criteria with formulas

Here are some formulas can help you to count the unique values with multiple criteria.

1. Copy the name list excluding header and then paste them in another location, and click Data > Remove Duplicates. See screenshot:
A screenshot showing the 'Remove Duplicates' feature in Excel's Data tab

2. In the popping warning dialog, check Continue with the current selection option, click Remove Duplicates button to go to next Remove Duplicates dialog, check the column header you want to remove duplicates, click OK. See screenshot:
A screenshot of the 'Remove Duplicates' dialog in Excel

3. Then the duplicate names are removed, and go to next cell beside the first name, I2 for instance, and type this formula =COUNTIFS(A2:A10,$H2,B2:B10,$E$2,C2:C10,$F$2), press Enter key and drag fill handle down to the cells you need to apply this formula. See screenshot:
A screenshot showing a COUNTIFS formula applied to count unique values based on multiple criteria in Excel

Tip: in this formula, A2:A10 is the name list in the original data, and H2 is the first name in the pasted list that you removed duplicates just now, B2:B10 is the list of Project, E2 is the criterion you want to find in Project column, C2:C10 is the Location range, and F2 is the criterion you want to match in Location column, you can change them as you need.

4. Now it list the times of matching the criteria in each name. Select a blank cell where you will place the unique value’s counting result, type this formula =COUNTIF(I2:I7,">0") and press Enter key. See screenshot:
A screenshot showing the COUNTIF formula used to count unique values greater than 0 in Excel


Count unique values with multiple criteria with Kutools for Excel

If you are confused with above formulas, you can apply Kutools for Excel’s Select Specific Cells and Select Duplicate & Unique Cells utilities to quickly handle it without any formulas.

Kutools for Excel offers over 300 advanced features to streamline complex tasks, boosting creativity and efficiency. Itegarate with AI capabilities, Kutools automates tasks with precision, making data management effortless. Detailed information of Kutools for Excel...         Free trial...

1. Select Project column range, and click Kutools > Select > Select Specific Cells. See screenshot:
A screenshot of the 'Select Specific Cells' option in Kutools tab in Excel

2. In the Select Specific Cells dialog, check Entire row option, and select Equals from the first drop down list in Specific type section, and enter the first criterion you need to match into the textbox. See screenshot:
A screenshot of the 'Select Specific Cells' dialog

3. Click Ok. A dialog pops out to remind you the number of selected rows, and click OK to close it. Then copy and paste the selected rows to another location. See screenshot:
A screenshot showing selected rows in Excel after applying the 'Select Specific Cells' tool

4. Select the Location column from the pasted data and reapply the Select Specific Cells, and check Entire Row, Equal and enter the second criterion into the textbox, and then click Ok > OK and copy and paste the match rows to another location. See screenshot:
A screenshot of the 'Select Specific Cells' dialog

5. Then select the names in last pasted data, and click Kutools > Select > Select Duplicate & Unique Cells. See screenshot:
A screenshot showing the 'Select Duplicate & Unique Cells' option in Kutools tab in Excel

6. In the Select Duplicate & Unique Cells dialog, check All unique (Include 1st duplicates) or Unique values only as you need, check Fill backcolor or Fill font color option, and click Ok. Now a dialog pops out to show you the total number of unique values in the selection, and at the same time matched values are selected and highlighted. See screenshot:
A screenshot showing the 'Select Duplicate & Unique Cells' dialog with unique values selected

Kutools for Excel - Supercharge Excel with over 300 essential tools. Enjoy permanently free AI features! Get It Now

Demo: Count Unique Values by Criteria

Kutools for Excel: Over 300 handy tools at your fingertips! Enjoy permanently free AI features! Download Now!

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more
Use Kutools in your preferred language – supports English, Spanish, German, French, Chinese, and 40+ others!

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!

All Kutools add-ins. One installer

Kutools for Office suite bundles add-ins for Excel, Word, Outlook & PowerPoint plus Office Tab Pro, which is ideal for teams working across Office apps.

Excel Word Outlook Tabs PowerPoint
  • All-in-one suite — Excel, Word, Outlook & PowerPoint add-ins + Office Tab Pro
  • One installer, one license — set up in minutes (MSI-ready)
  • Works better together — streamlined productivity across Office apps
  • 30-day full-featured trial — no registration, no credit card
  • Best value — save vs buying individual add-in