Search code examples
datetimegoogle-sheetsstring-formattinggoogle-sheets-formulaarray-formulas

List all months from date until another date


I have two dynamic dates:

"A5" - 2018-12-01
"B5" - 2019-04-31

I would like something that would help me list all the months along with their specific years that are between both those dates (including both of them).

The output would be:

December 2018
January 2019
February 2019
March 2019
April 2019

I need to do this without a Script. These dates difference are never going to be bigger than 2 years.

Is there a way to do this that you know of? I'm kind of stuck.


Solution

  • =ARRAYFORMULA(TEXT(UNIQUE(EOMONTH(ROW(INDIRECT(
     DATEVALUE(A5)&":"&DATEVALUE(B5))), 0)), "mmmm yyyy"))
    

    0

    note: 2019-04-31 is not a valid date