Need unique count of customer name to reseller name formula ASAP!!!

I have a large file of customers and resellers and need unique count of company name for the resellers.

Reseller      Customer
SAR Inc       McDonalds
SAR Inc       Burger King
SAR Inc       Wendy's
SAR Inc        Pizza Hut
PAUL DOT    Macy's
PAUL DOT    McDonalds
PAUL DOT    Wendy's

How do I show that SAR truly has 2 unique companies and PAUL DOT has 1 Unique company.

I gave a simple example but I have 3K resellers tied to numerous companies.

Any quick help will be appreciated!!!
glabossiAsked:
Who is Participating?
 
barry houdiniCommented:
That looks better, Brad....

I think, though, that you could combine some elements of both for a shorter non-array version, i.e.

=SUMPRODUCT((COUNTIFS(A$2:A$9,"<>"&D3,B$2:B$9,B$2:B$9)=0)/COUNTIF(B$2:B$9,B$2:B$9))

confirmed with CTRL+SHIFT+ENTER

That doesn't allow blanks - if you want to allow those then try

=SUMPRODUCT((COUNTIFS(A$2:A$9,"<>"&D3,B$2:B$9,B$2:B$9)=0)*(B$2:B$9<>"")/COUNTIF(B$2:B$9,B$2:B$9&""))

regards, barry
0
 
jppintoCommented:
I've used a 3rd column on my attached example to count how many times the Customer appears and then I've made a Pivot Table where I filter only the ones where the Count is like 1. This will give you the number of unique Customer that each Reseller has.

Hope this is clear to you.

jppinto
CountUniques.xlsx
0
 
glabossiAuthor Commented:
This almost worked.  But it is still not giving it.  I have some of them that are 1, but the rest are more than one.  The example below should show a unique count of 1 for this reseller and it shows two.

Reseller   Customer                        Unique Count
INSIGHT       1252 Properties, Inc.      2
INSIGHT       1252 Properties, Inc.      2
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
jppintoCommented:
You didn't mentioned that you had duplicate on your data... let me see now.
0
 
barry houdiniCommented:
Hello glabossi,

If you have a reseller name in D3 then you can use this formula for a count of different customers, see attached.

=SUMPRODUCT((MATCH(A$2:A$8&"-"&B$2:B$8,A$2:A$8&"-"&B$2:B$8,0)=ROW(A$2:A$8)-ROW(A$2)+1)*(A$2:A$8=D3))

regards, barry
0
 
barry houdiniCommented:
Here's the attachment......

barry
26874647.xlsx
0
 
jppintoCommented:
It's not that simple Barry...he wants unique costumers that are only from that reseller! That's the problem...
0
 
byundtCommented:
In jppinto's sample workbook, you can use the formula for the count of unique customers of a reseller:
=SUMPRODUCT((A$2:A$90=F4)/((A$2:A$90<>F4)+COUNTIFS(A$2:A$90,F4,B$2:B$90,B$2:B$90)))

The reference to row 90 is arbitrary, and may extend beyond the data. The reference to cell F4 is to the reseller's name.
0
 
byundtCommented:
Barry's formula works as requested (and tolerates blank cells to boot)--but mine is shorter for a change.

Here are both formulas in Barry's sample workbook:
26874647.xlsx
0
 
jppintoCommented:
I'm I the only one that understood the question or the only one that didn't?!?

It's my understanding that the user wants unique customers of a reseller that are not customers of other resellers, right?

jppinto
0
 
darcy_morseCommented:
use a countif on the customer for the same column.  That will give the number of customers in that column.  Then filter on the count field, and filter for the quantity of 1.  This will display the reseller and unique customer.
0
 
jppintoCommented:
@darcy_morse: The problem is when there are duplicate resellers+customers! If there wheren't duplicates, my fisrt solution would work!
0
 
glabossiAuthor Commented:
jppinto is correct.  My original posts did not include duplicates but the formula needs to account for it.

0
 
darcy_morseCommented:
col A             Col B               col C                                               Col D
Reseller        Customer     = concatenate(A1,"-",B1)        =countif(B:B,B1) - countif(C:C,C1)

Column D searches for number of customers and sutracts number of reseller customer combinations.  From there you can look where column D = 0.



0
 
byundtCommented:
To get the counts of 2 and 1, you might use:
=SUMPRODUCT((A$2:A$90=D3)*(COUNTIF(B$2:B$90,B$2:B$90)=1))
26874647.xlsx
0
 
barry houdiniCommented:
Sorry glabossi, I misunderstood the requirement, sounds like you understood it better jp!

Here's a formula solution

=SUM(IF(FREQUENCY(IF(COUNTIFS(A$2:A$10,"<>"&D2,B$2:B$10,B$2:B$10)=0,IF(B$2:B$10<>"",MATCH(B$2:B$10,B$2:B$10,0))),ROW(B$2:B$10)-ROW(B$2)+1),1))

That's an array formula that needs to be confirmed with CTRL+SHIFT+ENTER

where D2 contains the reseller name

see attached example

regards, barry
26874647v2.xlsx
0
 
byundtCommented:
If there might be duplicates, then you get 2 and 1 with:
=SUMPRODUCT((COUNTIF(B$2:B$9,B$2:B$9)=COUNTIFS(A$2:A$9,D3,B$2:B$9,B$2:B$9))/((COUNTIF(B$2:B$9,B$2:B$9)<>COUNTIFS(A$2:A$9,D3,B$2:B$9,B$2:B$9))+COUNTIFS(A$2:A$9,D3,B$2:B$9,B$2:B$9)))
26874647.xlsx
0
 
barry houdiniCommented:
just to clarify, then - I think the last formula suggested by Brad will give the same results as the last formula that I suggested - my version also allows blank rows......

regards, barry
0
 
byundtCommented:
I agree that Barry's formula works for the duplicate possibility and tolerates blank rows. Here is a somewhat shorter one that handles duplicates but doesn't tolerate the blanks:
=SUM(IF(COUNTIF(B$2:B$9,B$2:B$9)=COUNTIFS(A$2:A$9,D3,B$2:B$9,B$2:B$9),1/COUNTIF(B$2:B$9,B$2:B$9),0))

Like Barry's formula, it must be array-entered (CTRL + Shift + Enter).


26874647.xlsx
0
 
byundtCommented:
Barry,
Nicely done!

Brad
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.