Search code examples
excel-formulasumifs

How to sum a date's value AND neighboring values above


Sample Data With Desired Results Of CodeIm looking to add up the sum of daily data with the previous days. For example, in the picture, I want to look at 17-AUG and I get a sum of 35. That is, it sums A3: A10. It starts at A10 because that is 17-AUG, then all the values above it. Looking at 11-AUG, the result is three because it sums up only A3: A4 (1+2).

At first, I thought something like this would work, =SUMIF($B$3:$B$13, D3>=$A$3:$A$13), but this always returned FALSE. How would I do this? Thanks in advance.


Solution

  • This works for me, =SUMIF($A$3:$A$13, "<="&E3, $B$3:$B$13), try it. This $ sign is so that the range of dates and values do not change as you copy the formula.