arraysexcelmultidimensional-arrayexcel-formulasumproduct

Return a Two Dimensional Array using a Sum Product Formula (Excel)


I am looking to return a two-dimensional array using a sum product formula. I have a table full of values which contain two axis (see attached image for example)

enter image description here

I want to return a dynamic array which sums the values by the two axis. In this example, the returned table would have three columns corresponding to the unique axis values of the original table (Alpha, Beta, Delta), and 6 rows.

The typical way to sum a two dimensional array based on criteria is with a =SUMPRODUCT function. This function returns the sum based on the values of the two axis, however, I have not found a way to return a dynamic array using this formula.


Solution

  • Perhaps you could try using MMULT() function:

    enter image description here


    =UNIQUE(HSTACK(A1:A7,VSTACK(B1:H1,MMULT(B2:H7,N(B1:H1=TOCOL(B1:H1))))),1)
    

    Using LET() to avoid repeating same ranges with variables:

    =LET(a, B1:H1, UNIQUE(HSTACK(A1:A7,VSTACK(a,MMULT(B2:H7,N(a=TOCOL(a))))),1))