Google Sheets – VLOOKUP Sum to Calculate Total Hours Next to Dates

formulasgoogle sheetsgoogle-sheets-query

I'm attempting to calculate a total number of hours based on entering 2 different dates. Each day between the dates has assigned 'hours worked'.

I'm trying to use Sumproduct or Arrayformula and Sumif, not having luck with either as of just yet… Any help appreciated 🙂

sum from lookup table

SumIf

As far as i've got is selecting 2 dates and adding them together. Not everything inbetween

Best Answer

=SUMPRODUCT(QUERY({A9:B}, 
 "select Col2 
  where Col1>=date'"&TEXT(B1, "yyyy-mm-dd")&"' 
    and Col1<=date'"&TEXT(B2, "yyyy-mm-dd")&"'"))

0