I'm trying to generate an array of dates in Google Sheets, where I know the first date, the last one and I want the other dates to be at 1-month interval, with the date always being the last day of the month.
StartDate (C3) = 2019-03-31
EndDate (I3) = 2019-06-30
Expected outcome:
2019-03-31
2019-04-30
2019-05-31
2019-06-30
This is the code I have tried
=ArrayFormula(ADD(C3,row(INDIRECT("C1:C"&eomonth(I3,0)-C3))))
But it's returning this
2020-04-01
2020-04-02
2020-04-03
2020-04-04
2020-04-05
2020-04-06
2020-04-07
2020-04-08
2020-04-09
2020-04-10
2020-04-11
2020-04-12
2020-04-13
2020-04-14
2020-04-15
2020-04-16
2020-04-17
2020-04-18
2020-04-19
Please try:
=ARRAYFORMULA(EOMONTH(C3,ROW(INDIRECT("a1:a"&DATEDIF(C3,I3,"M")+2))-1))
=DATEDIF(C3,I3,"M")+2
= the number of monthes between 2 dates includind these dates. =ARRAYFORMULA(ROW(INDIRECT("a1:a3")))
= basic counter My formula comes in 3 flavors.
Column Formula
C Dates in between two dates
C =ArrayFormula(edate(A1,sequence(datedif(A1,A2,"M"))))
D Dates in between two dates including End_date
D =ArrayFormula(edate(A1,sequence(datedif(A1,A2,"M")+1)))
E Dates in between two dates including Start_date and End_date
E =ArrayFormula(edate(A1,sequence(datedif(A1,A2,"M")+2)-1))
And on https://sheetaki.com/auto-populate-dates-between-two-given-dates-in-google-sheets/ there is a very easy to understand method (once you understand all the SEQUENCE parameters), but for day increments
=ARRAYFORMULA(TO_DATE(SEQUENCE(B1- A1 +1,1,A1)))
Auto-Populate Dates Between Two Given Dates in Google Sheets
Auto-Generate Dates Between Two Given Dates in Google Sheets
google sheets generate | populate a line for each month between two dates
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.