I need a formula in Sheet 2 column D which will look up the values of columns B and C in Sheet 1 column A and calculate the sum of the values in column C. So for example, D2 will return 36.
=ARRAYFORMULA(IFERROR(VLOOKUP(A2:A, QUERY({Sheet1!B:C},
"select Col1, sum(Col2) where Col1 != '' group by Col1", 0), 2, 0)))