How to sum ​​values ​​in a range of dates in Google Docs Spreadsheets?

I have a Google Docs spreadsheet in the format below — here's an example.

• Column A → Dates
• Column B → Numbers

I'd like to sum values ​​in column B in a range of dates in column A.

Example:

Sum values ​​between 01-feb-12, and 29-feb-12.

In Excel, I used the following formula:

``````=SUMPRODUCT(N(A1:A1000>=A35),N(A1:A1000<=A36),B1:B1000)
``````

where:

• A35 = Start Date
• A36 = Last date
-

migrated from superuser.comFeb 28 '12 at 2:47

This question came from our site for computer enthusiasts and power users.

This works, see F35 in your sheet:

`SUMIF(E2:E33;">="&E35;B2:B33)-SUMIF(E2:E33;"<="&E36;B2:B33)`

column E is done by calculating a value for the dates to be able to compare them (`=VALUE(E1)`)

Note that separating the args for some reasons is done with `;`

-
It works! Thank you very much! But I don't need VALUE() function. The problem was with ; to separate the arguments. I used =sumif(A2:A33;">"&A36;B2:B33) and it worked perfectly. –  Victor Santos Feb 28 '12 at 12:17
just for clarification: yes it works because it use then alphabetical order on string, but you may have issues with different years... –  fixitagain Feb 28 '12 at 13:41
@fixitagain ah, I was wondering why I couldn't get my equation to work and I had wrongly assumed it was because of the formatting of the dates. Good info and +1 –  Raystafarian Feb 28 '12 at 14:30
I had to use this formula: SUM(B2:B33)-sumif(A2:A33;">="&A36;B2:B33)-sumif(A2:A33;"<="&A35;B2:B33) // Now everything is ok. Thank you again. –  Victor Santos Feb 28 '12 at 17:34
if you want to have alphabetical order coincidating with chronological, use the following format: `2012-02-29` ie `yyyy-mm-dd` –  fixitagain Feb 29 '12 at 14:34
Use this function instead of a `sumproduct`
`=sumif(A1:A1000;">="&A35;B1:B1000)-sumif(A1:A1000;"<"&A36;B1:B1000)`