I need a single formula for summing numbers that fall within an arbitrary number of date ranges.
You can use multiple SUMIFS()
for each date range and then sum the result of those SUMIFS()
s within a single cell like this:
=SUMIFS(dataRange, datesRange,">="&startDate, D:D,"<="&endDate) +
SUMIFS(dataRange, datesRange,">="&startDate, D:D,"<="&endDate) +
SUMIFS(dataRange, datesRange,">="&startDate, D:D,"<="&endDate)
But this requires that I know exactly how many date ranges I'm going to have. For my spreadsheet I won't know how many date ranges I will have, so it has to dynamically grab the dates ranges.
Sample Google Spreadsheet (currently editable, please feel free to use)