Search code examples
arraysif-statementgoogle-sheetsvlookupgoogle-query-language

Multiply Google Query Results Using Different Factors Per Row


I have a query that returns multiple rows per each key used. Each key has a different quantity that I would like to use as a factor to multiply each row by. I would like every result to be multiplied by the same factor set to KEY 1.

For example, all 3 cells in the multiply column for Key "45492" I would like multiplied by 1,600. I have the query used posted here, and the complete sheet too. I created a "TEST PAGE" that has all the necessary information to recreate a complete, usable function.

https://docs.google.com/spreadsheets/d/1nKWxcGnwm7FCnqbSZRWKODv51lInNDm3Fo_toAJ5qxY/edit?usp=sharing

=ARRAYFORMULA(IFNA(
QUERY({material_items}, 
 "where Col1 matches '"&TEXTJOIN("|", 1, B3:B)&"'", 0),
""))

enter image description here


Solution

  • try:

    =INDEX(IF(E3:E="",,G3:G*IFNA(VLOOKUP(E3:E, B3:C, 2, 0))))
    

    enter image description here