Calculate weighted usage of an item

OC2PS

New Member
Joined
Jan 18, 2018
Messages
11
I have a Google Sheets workbook with 2 worksheets. (I suspect the solution is the same for Excel or Google Sheets, and if need be, I can switch to Excel)

Sheet 1 lists about 1000 items (components). The list could grow.

Sheet 2 lists some products (200 or so at the moment, but the list could grow). Each product could contain up to 12 components. These are listed in columns C through N (all of these columns have data validation so that these need to be selected from Sheet 1's list of 1000 components). Column R contains the number of units of the product.

On sheet 1, next to each component, I want to calculate the number of units of the component used across all products. Of course countif will count only the instances of the particular component in Sheet 1!C2:N200. Similarly sumproduct doesn't fit the bill because 1. C through N are not numerical and 2. C through N are not fixed.

Is there a simple way to calculate the number of units for each component? (without using VBScript/Javascript, and without copy-pasting the transpose list of components onto Sheet 2)
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
This is what worked for me:
VBA Code:
=ARRAYFORMULA(IF(A2:A="",,IFERROR(VLOOKUP(A2:A,QUERY(SPLIT(FLATTEN(Sheet2!C2:N&"|"&Sheet2!R2:R),"|",0,0),"select Col1,SUM(Col2) group by Col1"),2,0),0)))
 
Upvote 0

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

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