Objective:I want to retrieve the content of the last row of a Google Form and do a simple computation with that and later return that value to the user.
Example: The form contains two questions: "How many apples do you want to buy?" and "How many oranges do you want to buy?"
In a separate sheet, I have the prices of apples and oranges and want to compute the total amount.
Important note: the sheet Answers contains the output of another Arrayformula.
What I have so far:
In the cell for the amount spent, I have:
=arrayformula( mmult( Answers!$A2:$B2 ; Prices!$A$1:$A$2 ) and I can expand it manually for row 3,...,N.
which gives me the same as:
=ARRAYFORMULA( mmult( index(Answers!A:B;row(A$2:A);0);Prices!$A$1:$A$2 ) )
I would like to fetch the content of the last row in my sheet Answers and then use mmult on that last row. Prices will not vary.
It is important that I do the computation for the last row only as this will be returned to the user.
What I don't understand:
The formula with arrayformula and index should work because row() returns the current row and the range in index is both columns. Is it because the row A2 in Answers is the result of another Arrayformula? At the moment, it only returns the first row and pastes it until the first blank row of Answers.
How could I modify the formula to achieve what I want?