Sum (or count) the values in a column based on values in another, and output total

pkiula

New Member
Joined
May 8, 2012
Messages
6
Hi, I have a product inventory file that looks broadly like this:

Code:
SKU  Category  Price    Stock
A01    Socks     10       1
A02    Socks      8       1
A03    Shoes     99       2
A04    Shoes     69       1
A05    Socks      5      10
A06    Shoes     99       1


Now I want to print:

1. The total "price" of Socks and Shoes.
2. The total "inventory" contribution of Socks and Shoes (i.e., each's total inventory divided by the total inventory).


My new worksheet needs to look like this:

Code:
Category    TotalPrice   ContributionOfTotalPrice    TotalStock    ContributionOfTotalStock
Socks          23                8%                     12              75%
Shoes         269               92%                      4              25%


How would I go about doing these? Many thanks for any tips or pointers!
 
Last edited:

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"
Robert Mika's solution in #8 should suffice. Just don't use C:C for the named range Stock.

I would just use something arbitrarily large. For instance C2:C9999
The reason is that array formula will run excessively slow when you are running it on the 1M+ rows that Excel 2007 and later have.
 
Upvote 0

Forum statistics

Threads
1,216,163
Messages
6,129,223
Members
449,495
Latest member
janzablox

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