Sumproduct question (I think)

Bob White

Board Regular
Joined
May 4, 2008
Messages
61
Hello Experts

In the attached table SKUs 1,5 and 7 all contain blue.

I want a function that will look up the quantity of each SKU that contains Blue in Table 2 (e.g. SKU 1 =55, SKU 5 =67 and SKU 7 =73) and then multiply and sum each of the quantities by the numbers in the column "Amount 1 per unit" and Amount 2 per unit" in Table 1.

In this example the function will return the 42,263 which equals Blue = SKU 1 (55 x 2x 23) + SKU 5 (67 x 6 x 63) + SKU 7 (8 x 8 x73)

[TABLE="width: 516"]
<tbody>[TR]
[TD="class: xl68, width: 87, bgcolor: transparent"]TABLE 1
[/TD]
[TD="class: xl66, width: 87, bgcolor: transparent"][/TD]
[TD="class: xl66, width: 87, bgcolor: transparent"][/TD]
[TD="class: xl66, width: 87, bgcolor: transparent"][/TD]
[TD="width: 75, bgcolor: transparent"][/TD]
[TD="width: 75, bgcolor: transparent"][/TD]
[TD="width: 64, bgcolor: transparent"][/TD]
[TD="width: 64, bgcolor: transparent"][/TD]
[TD="width: 64, bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="class: xl67, width: 87, bgcolor: transparent"]SKU
[/TD]
[TD="class: xl67, width: 87, bgcolor: transparent"]Colour
[/TD]
[TD="class: xl67, width: 87, bgcolor: transparent"]Amount 1 per unit
[/TD]
[TD="class: xl67, width: 87, bgcolor: transparent"]Amount 2 per unit
[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"]SKU 1
[/TD]
[TD="class: xl65, bgcolor: transparent"]blue
[/TD]
[TD="class: xl65, bgcolor: transparent"]2
[/TD]
[TD="class: xl65, bgcolor: transparent"]23
[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"]SKU 2
[/TD]
[TD="class: xl65, bgcolor: transparent"]red
[/TD]
[TD="class: xl65, bgcolor: transparent"]3
[/TD]
[TD="class: xl65, bgcolor: transparent"]21
[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"]SKU 3
[/TD]
[TD="class: xl65, bgcolor: transparent"]green
[/TD]
[TD="class: xl65, bgcolor: transparent"]4
[/TD]
[TD="class: xl65, bgcolor: transparent"]45
[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"]SKU 4
[/TD]
[TD="class: xl65, bgcolor: transparent"]yellow
[/TD]
[TD="class: xl65, bgcolor: transparent"]5
[/TD]
[TD="class: xl65, bgcolor: transparent"]41
[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"]SKU 5
[/TD]
[TD="class: xl65, bgcolor: transparent"]blue
[/TD]
[TD="class: xl65, bgcolor: transparent"]6
[/TD]
[TD="class: xl65, bgcolor: transparent"]63
[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"]SKU 6
[/TD]
[TD="class: xl65, bgcolor: transparent"]red
[/TD]
[TD="class: xl65, bgcolor: transparent"]7
[/TD]
[TD="class: xl65, bgcolor: transparent"]24
[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"]SKU 7
[/TD]
[TD="class: xl65, bgcolor: transparent"]blue
[/TD]
[TD="class: xl65, bgcolor: transparent"]8
[/TD]
[TD="class: xl65, bgcolor: transparent"]8
[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="class: xl66, bgcolor: transparent"][/TD]
[TD="class: xl66, bgcolor: transparent"][/TD]
[TD="class: xl66, bgcolor: transparent"][/TD]
[TD="class: xl66, bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="class: xl66, bgcolor: transparent"][/TD]
[TD="class: xl66, bgcolor: transparent"][/TD]
[TD="class: xl66, bgcolor: transparent"][/TD]
[TD="class: xl66, bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="class: xl68, bgcolor: transparent"]TABLE 2
[/TD]
[TD="class: xl66, bgcolor: transparent"][/TD]
[TD="class: xl66, bgcolor: transparent"][/TD]
[TD="class: xl66, bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="class: xl70, bgcolor: transparent"]SKU
[/TD]
[TD="class: xl70, bgcolor: transparent"]QTY
[/TD]
[TD="class: xl66, bgcolor: transparent"][/TD]
[TD="class: xl68, bgcolor: transparent"]Colour
[/TD]
[TD="class: xl68, bgcolor: transparent"]TOTAL QTY
[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"]SKU 1
[/TD]
[TD="class: xl65, bgcolor: transparent"]55
[/TD]
[TD="class: xl66, bgcolor: transparent"][/TD]
[TD="class: xl65, bgcolor: transparent"]blue
[/TD]
[TD="class: xl69, bgcolor: transparent"]42,263
[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"]SKU 2
[/TD]
[TD="class: xl65, bgcolor: transparent"]58
[/TD]
[TD="class: xl66, bgcolor: transparent"][/TD]
[TD="class: xl66, bgcolor: transparent"][/TD]
[TD="class: xl66, bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"]SKU 3
[/TD]
[TD="class: xl65, bgcolor: transparent"]61
[/TD]
[TD="class: xl66, bgcolor: transparent"][/TD]
[TD="class: xl71, bgcolor: transparent, colspan: 6"]Blue = SKU 1 (55 x 2x 23) + SKU 5 (67 x 6 x 63) + SKU 7 (8 x 8 x73)
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"]SKU 4
[/TD]
[TD="class: xl65, bgcolor: transparent"]64
[/TD]
[TD="class: xl66, bgcolor: transparent"][/TD]
[TD="class: xl66, bgcolor: transparent"][/TD]
[TD="class: xl66, bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"]SKU 5
[/TD]
[TD="class: xl65, bgcolor: transparent"]67
[/TD]
[TD="class: xl66, bgcolor: transparent"][/TD]
[TD="class: xl66, bgcolor: transparent"][/TD]
[TD="class: xl66, bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"]SKU 6
[/TD]
[TD="class: xl65, bgcolor: transparent"]70
[/TD]
[TD="class: xl66, bgcolor: transparent"][/TD]
[TD="class: xl66, bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"]SKU 7
[/TD]
[TD="class: xl65, bgcolor: transparent"]73
[/TD]
[TD="class: xl66, bgcolor: transparent"][/TD]
[TD="class: xl66, bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Here is one option, note: I get the same result as Marcelo suggests..


Excel 2013/2016
ABCDE
1TABLE 1
2SKUColourAmount 1 per unitAmount 2 per unit
3SKU 1blue223
4SKU 2red321
5SKU 3green445
6SKU 4yellow541
7SKU 5blue663
8SKU 6red724
9SKU 7blue88
10
11
12TABLE 2
13SKUQTYColourTOTAL QTY
14SKU 155blue32528
15SKU 258
16SKU 361
17SKU 464
18SKU 567
19SKU 670
20SKU 773
Sheet1
Cell Formulas
RangeFormula
E14=SUMPRODUCT(--(B3:B9=D14),C3:C9,D3:D9,SUMIFS(B14:B20,A14:A20,A3:A9))
 
Upvote 0
If the SKUs are in the same order in both tables you also can try (using data layout provided by FormR)
=SUMPRODUCT(--(B$3:B$9=D14),C$3:C$9,D$3:D$9,B$14:B$20)

M.
 
Last edited:
Upvote 0
Thanks you have been a great help.

What is the purpose of the "-- " after the first bracket in the equation?
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,286
Members
452,631
Latest member
a_potato

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