Search code examples
google-sheetssumgoogle-sheets-formulavlookupgoogle-query-language

Google Sheets - Sum row values in vlookup


I have G-Sheet like this one here:

Sales Weekly

In Sheet2 column I, I want to get sum qty from value in sheet Price

I have a formula like this:

TOTAL AVERAGE = Total Qty (week) * Grand Total          
        

Then the expected sum qty from Price sheet is calculated with Grand Total

First, I've tried:

=SUM(VLOOKUP(A3, Price!C2:F, 4, False))*H3

Second, I've tried:

=ARRAYFORMULA(VLOOKUP(A3, Price!F3:H, 3, False))*H3

All formulas don't get a value that I expect.

How can I achieve that?


Solution

  • try:

    =ARRAYFORMULA(IFNA(VLOOKUP(A3:A; QUERY({Price!D2:F}; 
     "select Col1,sum(Col3) where Col3 is not null group by Col1"); 2; 0)*H3:H))
    

    enter image description here