Help with a tricky formula doing an average across products across a 2D matrix and 2 dynamic arrays...

jmwbowen

Board Regular
Joined
Jul 27, 2012
Messages
58
Hello,

I'm needing help with a formula that'll be easier to describe with a picture:

1641424720474.png


  • GF5:GF13 isn't relevant to the formula needed, it's a dynamic array and used to create the two-dimensional matrix of numbers
  • GH4:GK4 is a transposed dynamic array and could be as short as 1 column or as long as 6 columns (numbers 1-6)
  • GH5:GK13 is a two-dimensional array that counts the number of records in a separate table where two columns match the criteria of the above-mentioned arrays
What I need is a dynamic array formula in GG5 that will:
  1. Multiply each value in the 2D array by the corresponding column's number in row 4, and then sum those products per row
  2. Average that result by dividing that sum by the sum of the values in the corresponding row in the 2D dynamic array
Example:
Row 9 should result in the value 1.6666666~
  • =sum((7*1),(3*2),(1*3),(1*4)) / sum(7,3,1,1)

Thanks in advance!
 

Attachments

  • 1641424446945.png
    1641424446945.png
    10 KB · Views: 8
  • 1641424482634.png
    1641424482634.png
    12.1 KB · Views: 6

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Hi

Excel Formula:
=MMULT($GH$5:$GK$13,TRANSPOSE($GH$4:$GK$4))/MMULT($GH$5:$GK$13,SEQUENCE(4)^0)
 
Upvote 0
Solution
You rock....this worked.

I had to change the fixed references to dynamic references. I couldn't figure out why you had the "^0" in there, and then remembered that it needed to multiply by 1, so "SEQUENCE (4) ^ 0" worked the same as "SEQUENCE (COLUMNS($GH$4#),,,0)".

Final formula came out to:
Excel Formula:
=MMULT($GH$5#,TRANSPOSE($GH$4#))/MMULT($GH$5#,SEQUENCE(COLUMNS($GH$4#),,,0))
 
Upvote 0

Forum statistics

Threads
1,214,952
Messages
6,122,458
Members
449,085
Latest member
ExcelError

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