Date based sum in Excel / Google Docs spreadsheets

The code

=SUMIF(D$2:D$30,"<="&A5,E$2:E$30)

should work in both Excel and Google Spreadsheets.


Assume your data are in D and E:

In column A, all dates of the month. In column B, all dates of the month converted to numbers (It's something like days since 1 Jan 1970 as a default.)

In Column F, all dates in Column D converted to numbers.

Then cells in in columns G:AM (or so), this formula: If (F1>B$1,0,E1) For each column, B1 goes one higher, so it's B1, b2, etc.

In cells in columns C(1-31) sum columns G-AM).

Then column C consists of 31 numbers corresponding to the 31 dates in column A.