Erik Steiner
Erik Steiner

Reputation: 601

Group by name and count unique values

I have an Excel file like this, where column A and B are given. I want to add column C and D that represent days. D is pretty easy, because it is always one day. C is tricky, because I want to count only "unique" days, where a branch can be one day maximum, where D counts all days.

     A       B      C      D
Row Name  Branch Unique Overall
1    Jack Health      1       1
2    Jack Health      0       1
3    Jack   Food      1       1
4   Jolie   Tech      1       1
5   Jolie   Food      1       1
6   Jolie   Tech      0       1
7   Jolie Health      1       1

I need column C and D for a pivot table like this:

Branch Unique Overall
Health      2       3
Food        2       2
Tech        1       2

I also could add names as a sub position.

Branch Unique Overall
Health      2       3
 -Jack      1       2
 -Jolie     1       1
Food        2       2
 -Jack      1       1
 -Jolie     1       1
Tech        1       2
 -Jolie     1       2

But that´s something, that can be done after preparing the data and what comes with the program anyway. So how can I design a formula that counts only unique branches for a data set of hundreds of rows?

Thank you!

Upvotes: 0

Views: 1340

Answers (1)

Scott Craner
Scott Craner

Reputation: 152650

In C2 put:

=--(COUNTIFS($A$2:A2,A2,$B$2:B2,B2)=1)

Then copy down

enter image description here

Upvotes: 2

Related Questions