Excel working day f...
 

MegaSack DRAW - This year's winner is user - rgwb
We will be in touch

[Closed] Excel working day formula help

10 Posts
5 Users
0 Reactions
84 Views
 IHN
Posts: 19877
Full Member
Topic starter
 

I have a date field, it gives the last day of the month, three months from an input date (cell d29):

=(EOMONTH(D29,3)

However, it turns out that if this end-of-month date falls on a non-working day, I instead need the calculated date to be the first working day after it. Any ideas?


 
Posted : 15/10/2020 10:14 am
Posts: 0
Free Member
 

Wrap it in workday()

An example:
https://exceljet.net/formula/get-last-working-day-in-month

Modify their example to +1 instead of -1


 
Posted : 15/10/2020 10:17 am
Posts: 10854
Full Member
 

And if you are including public holidays make sure someone has the job of keeping them updated in the workbook.


 
Posted : 15/10/2020 10:22 am
Posts: 268
Free Member
 

Can't you use network day formula ?

=Networkdays


 
Posted : 15/10/2020 10:24 am
 IHN
Posts: 19877
Full Member
Topic starter
 

Thanks. Looking at it, as I need the last day of the month (if that's a working day), or the first working day of the next month if it's not, I think I need to do that and some IF stuff:

=if(WORKDAY(EOMONTH(D29,3)+1,-1=EOMONTH(D29,3),EOMONTH(D29,3),WORKDAY(EOMONTH(D29,3)+1)

and probably sort the brackets out on that 🙂


 
Posted : 15/10/2020 10:25 am
 IHN
Posts: 19877
Full Member
Topic starter
 

And if you are including public holidays make sure someone has the job of keeping them updated in the workbook.

Ah, I thought workdays knew the holidays.


 
Posted : 15/10/2020 10:27 am
Posts: 10854
Full Member
 

No you need to have a list of public holidays somewhere else and include that range at the end of the workday formula.

If you use a static range then maintenance can be a pig - say you include dates to end of 2022 in A1:A19 then use that range in WORKDAY. Someone will then add 2023 holidays from A20 to A28 but won't update the range in the WORKDAY formula so your formula apparently stops working. I'd suggest using a dynamic named range or just the whole column $A:$A to avert that issue. Whatever you do obviously it's best to keep the holiday list on a separate worksheet from the data and use appropriate protection depending on how fiddly your users are.


 
Posted : 15/10/2020 10:54 am
Posts: 1294
Free Member
 

You can simplify that.

=WORKDAY(EOMONTH(D29,3)-1,1,holidays)

It looks back 1 day from the end of month and returns the next working day - so if the end of month is a working day you get that, if not then the next one it finds.

I make a named range for holidays as above, it's the easiest way to maintain it.


 
Posted : 15/10/2020 11:05 am
 IHN
Posts: 19877
Full Member
Topic starter
 

You can simplify that.

=WORKDAY(EOMONTH(D29,3)-1,1,holidays)

Well that's bleedin' obvious, isn't it *smacks forehead*

As for the holidays, I've got a table with all of them from now to 2050. If this spreadsheet is still in use by then well, some other bugger can sort it


 
Posted : 15/10/2020 11:11 am
Posts: 10854
Full Member
 

As for the holidays, I’ve got a table with all of them from now to 2050. If this spreadsheet is still in use by then well, some other bugger can sort it

Depends if anyone buggers around with bank hols for the likes of VE day anniversaries, or days off for a coronation (sorry Liz) etc


 
Posted : 15/10/2020 11:16 am
 IHN
Posts: 19877
Full Member
Topic starter
 

As long as they're not at the end of Jan, Apr, July or Oct, I don't care :


 
Posted : 15/10/2020 11:21 am