Google Sheets: array Formula that sums between 2 cell references

41 Views Asked by At

I'm having an issue creating a formula to dynamically sum values between 2 cell references.

I have the following data:

Name     |    Hours Worked     |
 John              20
         -----------------------
                   10
         -----------------------
                   8  
--------------------------------
 Stef              8
         -----------------------
                   10
--------------------------------
 Liiv              8
         -----------------------
                   10
         -----------------------
                   10
         -----------------------
                   8  

What I want to do is to produce a report in another sheet like this

Name     |    Hours Worked     |
 John              38
 Stef              18
 Liiv              36

Check out the sample file here

Thanks

1

There are 1 best solutions below

0
player0 On

try in D2:

=ARRAYFORMULA(QUERY({IFNA(REGEXEXTRACT(VLOOKUP(ROW(data!A8:A), 
 IF(data!A8:A<>"", {ROW(data!A8:A), data!A8:A}), 2, 1), "(.+)\n")), data!D8:D, 
 SUBSTITUTE(data!F8:F, "$", )*1}, 
 "select Col1,sum(Col2),sum(Col3) 
  where Col1 is not null 
  group by Col1 
  label sum(Col2)'',sum(Col3)''", 0))

enter image description here