Create an array of summed columns

Jek61

New Member
Joined
Jul 30, 2020
Messages
16
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi,

nice to be part of the forum.

I am finding it difficult to find a solution to the following and would welcome any assistance.

I have created a table which expands as new data is added, each column is a unique item which has a weight. I need to obtain the gross weight over all the columns, this will vary as the table expands.

Idealy the sumproduct function would work by multiplying the sum of each column by the weight of the item, but how can I create a formula which will create an array of the "sum" of each column then use this information as an array in the sumproduct function calulation then combine this with the weight array

I can get the result by creating a total on row 1, which sums each column the uses each total in the sumproduct function but I am interested if there is a more efficient way to achieve this answer.

1596099517745.png

Many thanks for looking.

Jek61
 

Attachments

  • 1596099124578.png
    1596099124578.png
    7.4 KB · Views: 4

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
I think that this will do what you need. You will need to change the 4 names of 'Table3' in the formula to the correct name for your own table.

=SUMPRODUCT(INDEX(Table3,0,2):INDEX(Table3,0,COLUMNS(Table3))*B2:INDEX(2:2,COLUMNS(Table3)))/1000
 
Upvote 0
Hi Jasonb75,

worked great many thanks.

Jek61.
 
Upvote 0
Welcome to the MrExcel board!

What about this? Might need Ctrl+Shift+Enter confirmation with your Excel 2016 (& 635 if you do not have the new dynamic array functionality)

20 07 30.xlsm
ABCDE
1
2Weight (kg)21.317.313.3
3Date1Item 1Item 2Item 3
418/07/1961000
530/07/2020201213
630/07/2020555
7
8
91.066
10
Jek61
Cell Formulas
RangeFormula
A9A9=SUM(IFERROR(Table3*(2:2),0))/1000


.. or if you know that your table would never exceed, say, 100 columns you could reduce the calculation overhead somewhat with

=SUM(IFERROR(Table3*(A2:CV2),0))/1000
 
Last edited:
Upvote 0
A further option

Enter a zero in A2 and custom format that cell as "Weight (kg)" then try this formula

=SUM(Table3*OFFSET(Table3,-2,,1))/1000
 
Upvote 0
Hi,

many thanks this solution also works.

Regards

Jek61
 
Upvote 0
Welcome to the MrExcel board!

What about this? Might need Ctrl+Shift+Enter confirmation with your Excel 2016 (& 635 if you do not have the new dynamic array functionality)

20 07 30.xlsm
ABCDE
1
2Weight (kg)21.317.313.3
3Date1Item 1Item 2Item 3
418/07/1961000
530/07/2020201213
630/07/2020555
7
8
91.066
10
Jek61
Cell Formulas
RangeFormula
A9A9=SUM(IFERROR(Table3*(2:2),0))/1000


.. or if you know that your table would never exceed, say, 100 columns you could reduce the calculation overhead somewhat with

=SUM(IFERROR(Table3*(A2:CV2),0))/1000
Hi The solution works fine.

many thanks.
 
Upvote 0
You're welcome. Thanks for the confirmation. :)
 
Upvote 0

Forum statistics

Threads
1,214,905
Messages
6,122,174
Members
449,071
Latest member
cdnMech

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