how to calculate number of days between 2 dates

Andy 1,351 Reputation points
2022-12-28T06:40:25.047+00:00

I'm trying to calculate the number of working days between 2 dates [Start Date] and [End Date], given 2 dates. means that I want to exclude the weekends, just count the working days(Monday,...Friday). How to do that?

Microsoft 365 and Office | SharePoint Server | For business
0 comments No comments
{count} votes

Answer accepted by question author
  1. Xuyan Ding - MSFT 7,601 Reputation points
    2022-12-28T09:12:39.843+00:00

    Hi @Andy ,

    Try this formula:

    IF(ISERROR(DATEDIF([Start Date],[End Date],"d")),"",(DATEDIF([Start Date],[End Date],"d"))+1-INT(DATEDIF([Start Date],[End Date],"d")/7)*2-IF((WEEKDAY([End Date])-WEEKDAY([Start Date]))<0,2,0)-IF(OR(AND(WEEKDAY([End Date])=7,WEEKDAY([Start Date])=7),AND(WEEKDAY([End Date])=1,WEEKDAY([Start Date])=1)),1,0)-IF(AND(WEEKDAY([Start Date])=1,(WEEKDAY([End Date])-WEEKDAY([Start Date]))>0),1,0)-IF(AND(NOT(WEEKDAY([Start Date])=7),WEEKDAY([End Date])=7),1,0))  
    

    274489-image.png
    274525-image.png


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.