Help! How to do a complex Count in Excel

abra

New Member
Joined
Jan 6, 2008
Messages
14
Below is an example table.

What I am after is for a excel forumula to count the number of instances that a item is unique in a set of three as below;

Here is the "data/source" table:
Book3.xls
ABCD
1ProductIDSupplierNameQuantity1-10PriceRank
21ABC0.00Low
31DEF54.60Middle
41GHI156.00High
52ABC0.00Low
62DEF0.00Middle
72GHI156.00High
83GHI0.00Low
93ABC0.00Middle
103DEF156.00High
114DEF0.00Low
124ABC0.00Middle
134GHI156.00High
Sheet1


And here is how I want the output table to be:
Book3.xls
DEFG
16SupplierNumberofProductsbeingthesolesupplier
17ABC0
18DEF1
19GHI2
20etcetc
Sheet1



So that for each supplier, the excel forumula calculates how many products are unique.

If a supplier has "£0.00" in the quantity band it would assume they do not supply that product.

Your input would be really appreciated.
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Dom, another Q related to this.

Is there an easy way for Excel to list out the sole Suppliers related to each Product ID,

e.g. in this case it would state that Supplier GHI is the only stockist for Product ID 4 and Product ID 2.

Many thanks,
 
Upvote 0
Dom, another Q related to this.

Is there an easy way for Excel to list out the sole Suppliers related to each Product ID,

e.g. in this case it would state that Supplier GHI is the only stockist for Product ID 4 and Product ID 2.

Many thanks,

The following is resource-intensive. So if the amount of data is large, you'll find the calculations too slow. If this is the case, a different approach will be necessary. Probably one involving helper columns. Also, if you have more than 251 unique products, we'll need to transpose the orientation/layout. Having said that, based on the prior results in E17, E18, E19, etc., try...

1) Select F17

2) Define (Insert > Name > Define) the following...

Code:
Name:  Array1

Refers to:

=ISNUMBER(MATCH(IF($C$2:$C$13>0,$A$2:$A$13,"#"),IF($B$2:$B$13=$D17,IF($C$2:$C$13>0,$A$2:$A$13)),0))

Click Add

Name:  Array2

Refers to:

=MATCH($A$2:$A$13,$A$2:$A$13,0)

Click Add

Name:  Array3

Refers to:

=ROW($A$2:$A$13)-ROW($A$2)+1

Click Ok

3) Try...

Code:
F17, confirmed with CONTROL+SHIFT+ENTER, copied across and down:

=IF(COLUMNS($F17:F17)<=$E17,INDEX($A$2:$A$13,SMALL(IF(FREQUENCY(IF(Array1,Array2),Array3)=1,Array3),COLUMNS($F17:F17))),"")

Hope this helps!
 
Upvote 0
Thanks Dom. No idea how you come up with these solutions soo quickly. I waas racking my brains for ages. :)
 
Upvote 0

Forum statistics

Threads
1,215,537
Messages
6,125,386
Members
449,221
Latest member
DFCarter

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