Date & Time functions
DAYS_IN_MONTH
About
Calculates the number of days from a particular time period, that occur within a particular month.
Inputs:
- start_date : start date of time period
- end_date : end date of time period
- eom_dates : a horizontal vector of month end dates
Code
M.S. Excel
DAYS_IN_MONTH = LAMBDA(start_date, end_date, eom_dates,
LET(
som_dates, DATE(YEAR(eom_dates), MONTH(eom_dates), 1),
min_end_date, BYCOL(eom_dates, LAMBDA(x, MIN(x, end_date))),
max_start_date, BYCOL(som_dates, LAMBDA(x, MAX(x, start_date))),
days_in_month, BYCOL(min_end_date - max_start_date + 1, LAMBDA(x, MAX(x, 0))),
days_in_month
)
);
Feedback
Submit and view feedback