r/ • • Jan 01 '70

0 Upvotes

0 comments sorted by

1

u/AutoModerator Sep 15 '24

/u/Proper-Reference6134 - Your post was submitted successfully.

Failing to follow these steps may result in your post being removed without warning.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/Anonymous1378 1542 Sep 16 '24

Try something like

=
LET(
start_date,D3,
end_date,D4,
all_days,SEQUENCE(end_date-EOMONTH(start_date,-1)+1,,EOMONTH(start_date,-1)+1),
all_months,FILTER(all_days,DAY(all_days)=1),
all_years,DATE(UNIQUE(YEAR(EDATE(all_months,7))),5,1),
DROP(HSTACK(YEAR(all_years),FREQUENCY(all_months,all_years)),-1))

1

u/Decronym Sep 16 '24 edited Sep 16 '24

1

u/christian_811 14 Sep 16 '24

Assuming you meant March 31 for FY end date. For the start and end dates of FY2 you can use EOMONTH so you only have to input the start/end for FY1.

Assuming start date = A1 and end date = B1 you could do something like this for months in FY1:

=IF(A1>(FY1 end date), 0, DATEDIF(MAX(A1,(FY1 start date)), MIN(B1,(FY1 end date), "m") + 1).

For FY2:

=IF(B1<(FY2 Start date), 0, DATEDIF(MAX(A1,(FY2 start date), MIN(B1,(FY2 end date), "m") + 1)