SEE BELOW FOR THE ANSWER.
I remember solving this with an array formula a while back, but I haven’t got the original workbook any more and the answer is completely escaping me.
Here’s sample data:
Salesman Product Bill Apple Bob Orange Bill Banana Bob Apple Bill Apple Bob Orange Bill Apple
What I’m wanting to do is make another table with the number of DISTINCT items Bob and Bill have sold. i.e:
Salesman Distinct Items Bill 2 Bob 2
I remember using the array formula trick with
IF to build an array based on a lookup value, but for the life of me I can’t figure out how I then applied a distinct count to that subsequent array. It was something to do with
FREQUENCY, but that only works with numbers and I haven’t even been able to replicate that when I’ve tried just numbers. Here I’ve played around with both
Specifically, with Bill in
D2 and Bob in
D3 I’ve arrived at this array formula (placed in
(D3 is obviously substituted for D2 in cell
It’s still way off, though. I’m using Evaluate Formula to trace it and I can see that the
COUNTIF counts all the occurrences of each item, not just the ones belonging to the lookup.
Any pointers back in the right direction? It’s really frustrating given that I cracked it once in the past.
(I realise with Excel 2013 I can do it with
Distinct Count in a PivotTable, but I’m needing to do it outside of one here for a couple of reasons.)
Thanks in advance.
EDIT – FOUND IT – SEE ANSWER BELOW
Answering my own question so that it will show up as having been resolved.
I went searching and came across this:
Here is the formula:
I don’t know how I did it before, but I’ll take whatever I can get after facepalming all day on this.
You can try this array formula:
Names in B2:B6, products in C2:C6 and name to look for in A2
Depending on your regional settings you may need to change field separator “;” by “,”