Forum Discussion
Anthony-123
May 14, 2024Iron Contributor
Using DATEDIF doesn't include first day (Calculating vacation days)
I have a SharePoint list generated by PowerAutomate to keep track of employee time off requests. I'm using two text columns called StartDate and EndDate. The column values look like 05/14/2024 00:00:...
Rob_Elliott
May 20, 2024Silver Contributor
Anthony-123 for inclusive working days excluding weekends I use:
=IF(ISERROR(DATEDIF(Start,End,"d")),"",(DATEDIF(Start,End,"d"))+1-INT(DATEDIF(Start,End,"d")/7)*2-IF((WEEKDAY(End)-WEEKDAY(Start))<0,2,0)-IF(OR(AND(WEEKDAY(End)=7,WEEKDAY(Start)=7),AND(WEEKDAY(End)=1,WEEKDAY(Start)=1)),1,0)-IF(AND(WEEKDAY(Start)=1,(WEEKDAY(End)-WEEKDAY(Start))>0),1,0)-IF(AND(NOT(WEEKDAY(Start)=7),WEEKDAY(End)=7),1,0))
Rob
Los Gallardos
Microsoft Power Automate Community Super User.
Principal Consultant, SharePoint and Power Platform WSP Global (and classic 1967 Morris Traveller driver)