Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Mohammedkb/81dab561999afcf555fbb63af3ddeebd to your computer and use it in GitHub Desktop.
Save Mohammedkb/81dab561999afcf555fbb63af3ddeebd to your computer and use it in GitHub Desktop.
CountWeekday Function with Excel Advanced Formula Environment (AFE) to count a specific weekday between two dates
CountWeekday = LAMBDA(StartDate, EndDate, WeekdayNumber,
LET(
DateRange, ROW(INDIRECT(StartDate & ":" & EndDate)), WeekdayRange, WEEKDAY(DateRange), WeekdayFound, N(WeekdayRange=WeekdayNumber), CountWeekday, SUM(WeekdayFound), CountWeekday
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment