Date & Time functions

DAYS_PASSED.PCT

About

Calculates the cumulative number of days that have passed from a particular time period - from the start of the period to the end of a given month. Results shown as a percentage, instead of days.

Calls DAYS_PASSED.

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_PASSED.PCT = LAMBDA(start_date, end_date, eom_dates,
    LET(
        days_passed, DAYS_PASSED(start_date, end_date, eom_dates),
        total_days, MAX(end_date - start_date + 1, 0),
        percent_days_passed, days_passed / total_days,
        IFERROR(percent_days_passed, "check dates!")
    )
);