Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a bunch of rows with a date and a dollar amount (expenses).

I want to produce a list of the days of the month and what the balance of the expenses is. So, for example the 5th entry in the list would be 8/5/2008 and the sum of all the expenses that occurred on or before 8/5/2008. Approximately this is =sumif(D4:D30-A5,">0",E4:E30) but of course that doesn't work (where the source data is dates in D4:D30 and the expenses are in E4:E30).


  • source data can't be sorted for various reasons.
  • must work in google spreadsheets, which is a fairly complete subset of excel's functions.
share|improve this question

migrated from stackoverflow.com Nov 1 '10 at 12:37

This question came from our site for professional and enthusiast programmers.

1 Answer 1

The code


should work in both Excel and Google Spreadsheets.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.