JordanBelf
JordanBelf

Reputation: 3338

Select only the rows which timestamp correspond to the current month

I am starting to try some experiments using Google SpreadSheets as a DB and for that I am collecting data from different sources and inserting them via spreadsheets API into a sheet.

Each row has a value (Column B) and a timestamp (Column A).

+---------------------+------+
|        ColA         | ColB |
+---------------------+------+
| 13/10/2012 00:19:01 |   42 |
| 19/10/2012 00:29:01 |  100 |
| 21/10/2012 00:39:01 |   23 |
| 22/10/2012 00:29:01 |    1 |
| 23/10/2012 00:19:01 |   24 |
| 24/10/2012 00:19:01 |    4 |
| 31/10/2012 00:19:01 |    2 |
+---------------------+------+

What I am trying to do is to programmatically add the sum of all rows in Column B where Column A is equal to the current month into a different cell.

Is there any function that I can use for that? Or anyone can point me to the right direction on how can I create a custom function which might do something like this? I know how to do this using MySQL but I couldn't find anything for Google SpreadSheets

Thanks in advance for any tip in the right direction.

Upvotes: 0

Views: 397

Answers (1)

AdamL
AdamL

Reputation: 24599

Would native spreadsheet functions do?

=ArrayFormula(SUMIF(TEXT(A:A;"MM/yyyy");TEXT(GoogleClock();"MM/yyyy");B:B))

Upvotes: 1

Related Questions