Sign up ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

The title kind of says it all but just to give you the use case, I have a spreadsheet where I track monthly ad revenue and want to end up with a daily revenue column.

Here's a simplified example of what I have today:

2012-04 | $456.78
2012-03 | $345.67
2012-02 | $234.56
2012-01 | $123.45

Here's a simplified example of what I'd like:

2012-04 | $456.78       | 30
2012-03 | $345.67       | 31
2012-02 | $234.56       | 29
2012-01 | $123.45       | 31

Obviously I'd like this in the form of a formula so I don't need to do any kind of manual tweaking. Is there some kind of formula that can take in 2012-04 and spit out 30?

share|improve this question

3 Answers 3

I stumbled across the EOMONTH function which is exactly what I needed, I end up doing a bunch of substring stuff but it seems to work which is all that is important to me.

Here's an example that will get you the number of days in field A2 assuming it's in YYYY-MM format

share|improve this answer

Parsing a Date with Left and Right might be unreliable (for example, in case the data format changes).

You could simplify the formula by using the DAY function instead:

=DAY( EOMONTH(RIGHT(A2,2)&"/01/"&LEFT(A2,4),0) )

Also the way you compose the date inside the EOMONTH call could be replaced, using the DATE(<year>, <month>, <day>) function to make it a little more reliable.

So, the final formula would become:

=DAY( EOMONTH( DATE(LEFT(B51,4), RIGHT(B51,2), 1) ,0) )
share|improve this answer

I use this formula:


You'll have to replace today() with a date or a cell containing a date in the month for which you want the total number of days.

share|improve this answer
You're missing a last parenthesis, but this is definitely the best answer. +1 – willlma Nov 6 '14 at 4:10

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.