Count Unique combinations of 2 columns or more

Cheko

New Member
Joined
Apr 14, 2017
Messages
6
Hi guys, I´m new to the forum.

I´m having trouble with a formula that would allow me to search for the frequency of a column conditioned to anothe column, I can´t use pivot tables since the data comes from a Query from SQL that needs to be automated on excel.

Count MerchantMerchant IDTeam ID
SAM=sum(if(frequency(if(....
24168596915

<tbody>
</tbody>
SAM

<tbody>
</tbody>
DS
21173871305

<tbody>
</tbody>
FBA

<tbody>
</tbody>

<tbody>
</tbody>
FBA
24168596915

<tbody>
</tbody>
SAM
15085426115

<tbody>
</tbody>
FBA

<tbody>
</tbody>
38275210615

<tbody>
</tbody>
DS

<tbody>
</tbody>

<tbody>
</tbody>


Any help is appreciated!
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
you are not stating clearly (for me anyway) what you want

is it how many of 24168596915 paired with sam and eg 123456789 paired with sam or DS
 
Upvote 0
Correct, I want to count of all the "merchant ID" paired with "ID" e.g. for the table above: SAM = 1(since it´s the same merchan ID#), DS =1 & FBA =1. The main problem is thar both Merchant ID & ID repeat througout the whole rows a vast number of times and i want the formula to count every unique pair only as one. I don´t know if I´m being clear?
 
Upvote 0
namenumbernamenum
sam24168596915sam24168596915
ds21173871305ds21173871305
fba123456789fba123456789
sam15085426115sam15085426115
fba38275210615fba38275210615
ds24168596915ds24168596915
ds21173871305ds21173871305
sam123456789sam123456789
sam15085426115sam15085426115
ds21173871305ds21173871305
Count of namenum
namenumTotal
ds211738713052
ds241685969151
fba1234567891
fba382752106151
sam1234567891
sam150854261152
sam241685969151
Grand Total9
a simple pivot table working on concatenated name_number ?

<colgroup><col><col><col><col span="2"><col><col><col span="2"></colgroup><tbody>
</tbody>
 
Upvote 0
Thannks for the reply, but I need to extract it as it is with a formula, as I said previously it can´t be pivot table or calculate a concatenated field and the another formula.
 
Upvote 0
Thanks for the reply again oldbrewer, not to sound rude but i know how to use pivot tables, the thing is that it´s a sheet that comes from an SQL Query from a metric job for an excel slide that gets sent automatically through an email nudge. And also it has to be presented into a specific format and a Pivot table doesn´t work. Thanks again!
 
Upvote 0
Try


A
B
C
D
E
1
Count Merchant​
Merchant ID​
Team ID​
2
SAM​
1​
24168596915​
SAM​
3
DS​
1​
21173871305​
FBA​
4
FBA​
2​
24168596915​
SAM​
5
15085426115​
FBA​
6
38275210615​
DS​
7

Array formula in B2 copied down
=SUM(IF(FREQUENCY(IF($E$2:$E$100=A2,MATCH($D$2:$D$100,$D$2:$D$100,0)),ROW($A$2:$A$100)-ROW($A$2)+1),1))
confirmed with Ctrl+Shift+Enter, not just Enter

Hope this helps

M.
 
Upvote 0

Forum statistics

Threads
1,216,179
Messages
6,129,332
Members
449,502
Latest member
TSH8125

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