How do I calculate the number of business days between a date range?

Quick Tip

Need help getting started? Our Number of Business Days template has these calculations set up and ready to go!

To calculate the number of days (excluding Saturday and Sunday) between two dates:

  1. Add two Date fields to your form – one labelled Start Date, and another labelled End Date.
  2. Add a Calculation field to your form labelled Number of Days. Set it to the Number type, and make sure that it’s set to internal view only. Then, use the following expression: =(EndDate - StartDate).Days
  3. Add another Calculation field labelled Number of Business Days. Set it to the Number type and use the following expression:
=if StartDate.DayOfWeek = "Monday" then Math.Min(1+NumberOfDays%7,5) + (if NumberOfDays>6 then 5*Math.Floor(NumberOfDays/7) else 0) else
 if StartDate.DayOfWeek = "Tuesday" then Math.Min(1+NumberOfDays%7,4) + (if NumberOfDays>5 then 5*Math.Floor(NumberOfDays/7) + Math.Max(NumberOfDays%7-5,0) else 0)  else
 if StartDate.DayOfWeek = "Wednesday" then Math.Min(1+NumberOfDays%7,3) + (if NumberOfDays>4 then 5*Math.Floor(NumberOfDays/7) + Math.Max(NumberOfDays%7-4,0) else 0) else
 if StartDate.DayOfWeek = "Thursday" then Math.Min(1+NumberOfDays%7,2) + (if NumberOfDays>3 then 5*Math.Floor(NumberOfDays/7) + Math.Max(NumberOfDays%7-3,0) else 0) else
 if StartDate.DayOfWeek = "Friday" then Math.Min(1+NumberOfDays%7,1) + (if NumberOfDays>2 then 5*Math.Floor(NumberOfDays/7) + Math.Max(NumberOfDays%7-2,0) else 0) else
 if StartDate.DayOfWeek = "Saturday" then (if NumberOfDays>1 then 5*Math.Floor(NumberOfDays/7) + Math.Max(NumberOfDays%7-1,0) else 0) else
Math.Min(NumberOfDays%7,5) + (if NumberOfDays>0 then 5*Math.Floor(NumberOfDays/7) + Math.Max(NumberOfDays%7-6,0) else 0)

Essentially, the first calculation determines the number of days between the two dates. Then, the second calculation calculates the total number of days excluding the weekend.

Learn more in our Date/Time Calculations guide.