Forum Discussion
JD1455
Mar 06, 2024Copper Contributor
Formula to remove afterhours and weekends from number
First, let me tell you that I am alright at Excel, but am by no means an expert. I have a formula our users are using, where they now want to remove any time afterhours (outside 8AM-5PM) and weekend...
- Mar 06, 2024
Here is a solution using a custom VBA function.
Press Alt+F11 to activate the Visual Basic Editor and to view the code of the function.
HansVogelaar
Mar 06, 2024MVP
Why should it be 3:57:00?
Friday 02-16-2024 13:05 to 17:00 on that day is 03:55.
Saturday 02-17-2024 and Sunday 02-18-2024 are excluded.
Monday 02-19-2024 8:00 to 17:00 is 9:00.
Tuesday 02-20-2024 8:00 to 17:00 is 9:00.
Wednesday 02-21-2024 8:00 to 8:02 is 0:02.
Total is 21:57
- JD1455Mar 06, 2024Copper ContributorMy apologies, you are correct. I was looking at another row in the spreadsheet.
- HansVogelaarMar 06, 2024MVP
Here is a solution using a custom VBA function.
Press Alt+F11 to activate the Visual Basic Editor and to view the code of the function.