Search code examples
arraysgoogle-sheetsmultidimensional-arraytransposegoogle-query-language

Multiply each row using Arrayformula


In Google Sheets, I have the following data:

   |   A |  B  |  C  |  ...  | G  | TOTALS   
 1 |  100|  200|  400|  ...  | 870| =PRODUCT(A1:G1)  |
 2 |  120|  240|  360|  ...  | 232| =PRODUCT(A2:G2)  |
 3 |  125|  425|  100|  ...  | 509| =PRODUCT(A3:G3)  |

How can I create the TOTALS column using ARRAYFORMULA?


Solution

  • shorter and should be faster (with some tweaking for sure):

    =INDEX(IFERROR(1/(1/DPRODUCT(TRANSPOSE({A1:A*0, A1:G}), 
     SEQUENCE(ROWS(A1:A)), {IF(,,); IF(,,)}))))
    

    enter image description here