Sumproduct with 3 tables?

killerstein

New Member
Joined
Jan 13, 2021
Messages
4
Office Version
  1. 2019
Platform
  1. Windows
Dear users,

I am trying to do the following but have been unsuccessful therefore I seek your help;

I have vendors who buy TVs from certain Towns. The top left table displays the quantities of TVs bought by each vendor who has a record of purchase while the bottom left table displays the sourcing structure of each vendor (the proportion of TVs purchased from each town). With these data, I would like to fill the top right table, which should show how many TVs a specific town has supplied in a specific month. Thus, for a specific cell on the top right table, I would like to lookup/match the name of the town in the bottom left table, I would like to lookup the name of all the vendors with records (top left table) in the bottom left table and then multiply the respective quantities with the respective proportions and finally sum them all to find how many TVs a town supplied to all the vendors in total for a specific month.

For example, the quantities for town F (in all the months) should be vendor 5's quantities multiplied by 0.5 because vendor 5 is the only one with qty data that sources from town F and its sourcing ratio is 0.5 (50%). On the other hand, for town M it should be 0.5*(qty of vendor 2) + 0.04*(qty of vendor 5).

I am unsure what formula I should use; I tried sumproduct with lookup/match, or sumifs, but could not figure out a way.


1708707404271.png
1708707404271.png
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
First of all, I'd recommend you investigate the xl2bb tool. (See the link in my signature, or in the reply box.) This allows you to put a mini-sheet in your message, that anyone can copy and paste into their Excel to work on it. Most people will not take the time to manually retype your entire sheet from a picture. You're likely to get quicker and better solutions if you do this.

Next, consider this:

Book1
JKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJ
5JanFebMarAprMayJunJulAugSepOctNovDecJanFebMarAprMayJunJulAugSepOctNovDec
6Vendor 1141984163910Town A00
7Vendor 235934580Town B22804.878309.4
8Vendor 336636643Town C10558.083078.4
9Vendor 4Town D83978.2385278.57
10Vendor 52356519987Town E00
11Vendor 65635769114Town F11782.59993.5
12Vendor 74060811840Town G100262.6110850.1
13Vendor 83577622120Town H00
14Vendor 9Town I00
15Vendor 10Town J00
16Vendor 11Town K00
17Vendor 12Town L00
18Vendor 13Town M2739.13089.48
19Vendor 14
20Vendor 15
21
22Town ATown BTown CTown DTown ETown FTown GTown HTown ITown JTown KTown LTown M
23Vendor 10.410.59
24Vendor 20.470.5
25Vendor 30.490.51
26Vendor 40.5
27Vendor 50.50.04
28Vendor 60.05
29Vendor 70.520.26
30Vendor 80.670.33
31Vendor 90.710.02
32Vendor 100.750.050.2
33Vendor 110.030.080.19
34Vendor 120.810.19
35Vendor 130.140.86
36Vendor 140.870.040.040.030.02
37Vendor 151
Sheet7
Cell Formulas
RangeFormula
Y6:Z18Y6=SUMPRODUCT(K$6:K$20*INDEX($K$23:$W$37,0,MATCH($X6,$K$22:$W$22,0)))


I made both of your source tables have the same number of vendors. This makes the solution much easier. Let us know how this works for you.
 
Upvote 0
First of all, I'd recommend you investigate the xl2bb tool. (See the link in my signature, or in the reply box.) This allows you to put a mini-sheet in your message, that anyone can copy and paste into their Excel to work on it. Most people will not take the time to manually retype your entire sheet from a picture. You're likely to get quicker and better solutions if you do this.

Next, consider this:

Book1
JKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJ
5JanFebMarAprMayJunJulAugSepOctNovDecJanFebMarAprMayJunJulAugSepOctNovDec
6Vendor 1141984163910Town A00
7Vendor 235934580Town B22804.878309.4
8Vendor 336636643Town C10558.083078.4
9Vendor 4Town D83978.2385278.57
10Vendor 52356519987Town E00
11Vendor 65635769114Town F11782.59993.5
12Vendor 74060811840Town G100262.6110850.1
13Vendor 83577622120Town H00
14Vendor 9Town I00
15Vendor 10Town J00
16Vendor 11Town K00
17Vendor 12Town L00
18Vendor 13Town M2739.13089.48
19Vendor 14
20Vendor 15
21
22Town ATown BTown CTown DTown ETown FTown GTown HTown ITown JTown KTown LTown M
23Vendor 10.410.59
24Vendor 20.470.5
25Vendor 30.490.51
26Vendor 40.5
27Vendor 50.50.04
28Vendor 60.05
29Vendor 70.520.26
30Vendor 80.670.33
31Vendor 90.710.02
32Vendor 100.750.050.2
33Vendor 110.030.080.19
34Vendor 120.810.19
35Vendor 130.140.86
36Vendor 140.870.040.040.030.02
37Vendor 151
Sheet7
Cell Formulas
RangeFormula
Y6:Z18Y6=SUMPRODUCT(K$6:K$20*INDEX($K$23:$W$37,0,MATCH($X6,$K$22:$W$22,0)))


I made both of your source tables have the same number of vendors. This makes the solution much easier. Let us know how this works for you.
Hello Eric,

Thanks for your recommendation and apologies for the inconvenience as I was not aware of this (my 2nd post to date). The important detail is that the tables are not the same size (with regards to vendors), so I would really appreciate if the solution is more catered towards the situation I presented above, because indeed with the same number of vendors it is easier to do but the main difficulty was that also the numbers of columns/rows are different. Hopefully this is possible. Thanks in advance!

Kind Regards,
E.G.
 
Upvote 0
I still believe it makes more sense to design your tables in such a way to make reading and calculating with them easy, but here are some options:

Book1
JKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJ
4
5JanFebMarAprMayJunJulAugSepOctNovDecJanFebMarAprMayJunJulAugSepOctNovDec
6Vendor 1141984163910Town A00
7Vendor 235934580Town B22804.878309.4
8Vendor 336636643Town C10558.083078.4
9Vendor 4Town D83978.2385278.57
10Vendor 52356519987Town E00
11Vendor 65635769114Town F11782.59993.5
12Vendor 74060811840Town G100262.62110850.13
13Vendor 83577622120Town H00
14Town I00
15Town J00
16Town K00
17Town L00
18Town M2739.13089.48
19
20
21Town ATown BTown CTown DTown ETown FTown GTown HTown ITown JTown KTown LTown M
22Vendor 10.410.59
23Vendor 20.470.5
24Vendor 30.490.51
25Vendor 40.5
26Vendor 50.50.04
27Vendor 60.05
28Vendor 70.520.26
29Vendor 80.670.33
30Vendor 90.710.02
31Vendor 100.750.050.2
32Vendor 110.030.080.19
33Vendor 120.810.19
34Vendor 130.140.86
35Vendor 140.870.040.040.030.02
36Vendor 151
37
Sheet7
Cell Formulas
RangeFormula
Y6:Y18Y6=SUMPRODUCT(K$6:K$13*INDEX($K$22:$W$36,MATCH($J$6:$J$13,$J$22:$J$36,0),MATCH($X6,$K$21:$W$21,0)))
Z6:Z18Z6=SUMPRODUCT(L$6:L$13*SUMIFS(INDEX($K$22:$W$36,0,MATCH($X6,$K$21:$W$21,0)),$J$22:$J$36,$J$6:$J$13))


The first option (column Y), I don't believe will work in your version of Excel. The second probably will, but I'm not entirely sure.
 
Upvote 1
Solution
I still believe it makes more sense to design your tables in such a way to make reading and calculating with them easy, but here are some options:

Book1
JKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJ
4
5JanFebMarAprMayJunJulAugSepOctNovDecJanFebMarAprMayJunJulAugSepOctNovDec
6Vendor 1141984163910Town A00
7Vendor 235934580Town B22804.878309.4
8Vendor 336636643Town C10558.083078.4
9Vendor 4Town D83978.2385278.57
10Vendor 52356519987Town E00
11Vendor 65635769114Town F11782.59993.5
12Vendor 74060811840Town G100262.62110850.13
13Vendor 83577622120Town H00
14Town I00
15Town J00
16Town K00
17Town L00
18Town M2739.13089.48
19
20
21Town ATown BTown CTown DTown ETown FTown GTown HTown ITown JTown KTown LTown M
22Vendor 10.410.59
23Vendor 20.470.5
24Vendor 30.490.51
25Vendor 40.5
26Vendor 50.50.04
27Vendor 60.05
28Vendor 70.520.26
29Vendor 80.670.33
30Vendor 90.710.02
31Vendor 100.750.050.2
32Vendor 110.030.080.19
33Vendor 120.810.19
34Vendor 130.140.86
35Vendor 140.870.040.040.030.02
36Vendor 151
37
Sheet7
Cell Formulas
RangeFormula
Y6:Y18Y6=SUMPRODUCT(K$6:K$13*INDEX($K$22:$W$36,MATCH($J$6:$J$13,$J$22:$J$36,0),MATCH($X6,$K$21:$W$21,0)))
Z6:Z18Z6=SUMPRODUCT(L$6:L$13*SUMIFS(INDEX($K$22:$W$36,0,MATCH($X6,$K$21:$W$21,0)),$J$22:$J$36,$J$6:$J$13))


The first option (column Y), I don't believe will work in your version of Excel. The second probably will, but I'm not entirely sure.
Dear Eric,

Thank you very much. Both of the solutions have worked just fine. I also understand your point as to why I should arrange the tables in a more convenient way, however the tables in the screenshot/question were exemplary. In the real situation I have a similar case but in a pivot table format for the top left table, so that one cannot be arranged (vendors without data do not show up, as in your initial response which included vendors 9-15 for the top left table). The other ones I could arrange to my liking but I believed this was the best way to summarise for myself. Nonetheless, thanks for the efforts and time and I will take up to your advise for any of my future posts about the xl2bb.

Kind regards,
EG
 
Upvote 0

Forum statistics

Threads
1,224,814
Messages
6,181,125
Members
453,021
Latest member
Justyna P

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