Clever formula to count unique instances of two columns?

RockandGrohl

Well-known Member
Joined
Aug 1, 2018
Messages
801
Office Version
  1. 365
Platform
  1. Windows
Morning everyone. In excel I have a dataset which has multiple rows per projectID.

Column A is ProjectID, and column E is Version, which holds information on what version of the ProjectID it is. For example, there can be 30 lines for Project 12345, which only has Version 3, so the result I want is "1" because there's only one combination of Project 12345 with Version 3.

If there's another ProjectID such as Project 09876 with 20 lines for Version 3, and then another 20 lines for Project 09876 for Version 5, then I'd like the formula to result in "2" for each line of Project 09876 because there are two valid combinations of ProjectID and Version.

What formula can I use for this? I'm thinking of some clever combination of Countifs etc.


This table is being imported into Power BI so if there's a better way to do this with a measure, I'm all ears. I just thought I'd do it in Excel for familiarity
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

I'm sort of looking for something like this but where I can countifs, so I can say for each project ID, how many unique Versions are there?
 
Upvote 0
Excel Formula:
=IFERROR(ROWS(UNIQUE(FILTER($E$2:$E$10000,$A$2:$A$10000=$A2))),0)

This is what I was after. Seems to work nicely.
 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top