Search code examples
arraysexcelarray-formulas

Excel M x N matrix MULTIPLY numbers in same row and return an array But Don't MULTIPLY all


0.6 0.4 0.5 =>> 0.12

0.4 0.8 0.5 =>> 0.16

the size of M x N matrix, which is a return of array formula, is not fixed. I know there is PRODUCT, but it just gives me a single number of multiplication of all numbers. I need an array of the multiplication of numbers in each row


Solution

  • If you have your matrix starting from C1, and you enter your formula from A1, then it'll be:

    {=PRODUCT(OFFSET(C1,ROW()-1,0,1,COUNT(C1:XFD1)))}

    Some notes on it:

    • it's an array formula, working only if you enter to the whole range, so:
      • select a range which will be likely big enough to host data for all rows of the matrix, like A1:A50
      • enter the formula in A1
      • press CTRL+SHIFT+ENTER
    • it'll work correctly only if there is no data from the right of your matrix
    • of course calculations can be at different location compared to your matrix, just make sure to adapt references accordingly.
    • the matrix should be complete (all rows has the same number of columns)