PQ Networkdays

RattlingCarp3048

Board Regular
Joined
Jan 12, 2022
Messages
202
Office Version
  1. 365
Platform
  1. Windows
I have created a new custom column with a simple (startdate - enddate)*24 then change the data type to decimal and round in order to calculate to hours like i need. in the custom column i tried the networkdays formula but that didnt work. i also found a custom function for creating your own networkdays function but that just gives me an error for all rows (pasted below). how do i exclude weekends and holidays??

**with 5/27/24 as a holiday** (startdate - enddate)*24
1718911745666.png


custom networkdays
(StartDate as date, EndDate as date, HolidayList as list) =>

let
DateList=List.Dates(StartDate,Number.From(EndDate-StartDate)+1,#duration(1,0,0,0)),
RemoveWeekends=List.Select(DateList, each Date.DayOfWeek(_,Day.Monday)<5),
RemoveHolidays=List.RemoveItems(RemoveWeekends, HolidayList),
CountDays=List.Count(RemoveHolidays)
in
CountDays
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Have you looked at this web page?

 
Upvote 0
Have you looked at this web page?

not previously but the code they are using is extremely similar to what i am using. the only difference is they switched the order of removing weekends vs removing holiday's. I'll give their's a try....
 
Upvote 0
Have you looked at this web page?

Hello... i still get the same error as before. in the query code for networkdays all the examples shown the date is just a date. but for me all of mine are date/time. would that have anything to do with the error?

1720279735835.png

1720279757961.png
 
Upvote 0

Forum statistics

Threads
1,225,353
Messages
6,184,457
Members
453,233
Latest member
bgmb

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top