# Discussions

View Only

## Calculating duration between two date fields but working days only?

• #### 1.  Calculating duration between two date fields but working days only?

Posted 04-28-2015 13:53

Hi,

I need a formula that calculates the duration between two date fields but only counts working day (Monday through Friday) and not just the total number days.

So for example;

01-Apr-2015 to 07-Apr-2015 - Normal total duration formula would display result as 6 days but I require it to show just 4 days for this example.

• #### 2.  RE: Calculating duration between two date fields but working days only?

Top
Contributor
Posted 04-28-2015 13:54
No problem, there is a function for that as a formula-numeric field.

WeekDaySub([start date],[end date])

• #### 3.  RE: Calculating duration between two date fields but working days only?

Posted 07-20-2018 04:06

• #### 4.  RE: Calculating duration between two date fields but working days only?

Posted 07-16-2019 02:21
I've tried this but I get "Expecting date but found workdate". Any ideas?

• #### 5.  RE: Calculating duration between two date fields but working days only?

Top
Contributor
Posted 07-16-2019 02:22

But basically your fields are work dates and you need to convert them to date using the ToDate function.

• #### 6.  RE: Calculating duration between two date fields but working days only?

Posted 07-16-2019 02:23
WeekDaySub([Start],[Projected Finish])

• #### 7.  RE: Calculating duration between two date fields but working days only?

Top
Contributor
Posted 07-16-2019 02:25
I don�t know what field types your two fields are but if they were both work dates, then the formula would be

WeekDaySub(ToDate([Start]),ToDate([Projected Finish]))

Admittedly, working with work dates is confusing.

• #### 8.  RE: Calculating duration between two date fields but working days only?

Posted 07-16-2019 02:28
Thanks Mark but I got the "Expected duration but found number" message

• #### 9.  RE: Calculating duration between two date fields but working days only?

Top
Contributor
Posted 07-16-2019 02:37
I suggest changing your field type of formula in the mirror and then the result would be an integer number of days.

But if you really want it to be in a formula direction field you would have to wrap the formula in Days(......)

• #### 10.  RE: Calculating duration between two date fields but working days only?

Top
Contributor
Posted 07-16-2019 02:38
Days(WeekDaySub(ToDate([Start]),ToDate([Projected Finish])))

• #### 11.  RE: Calculating duration between two date fields but working days only?

Posted 07-16-2019 02:37
maybe i just need to change the workdate to regular date. I'll give that a try. thank you Mark

• #### 12.  RE: Calculating duration between two date fields but working days only?

Posted 07-16-2019 02:47
you're the best Mark. thank you