Solved

Workday (use preceeding workday)

Posted on 2014-11-07
6
125 Views
Last Modified: 2014-11-07
Hello,

What do I need to change in the below to return the workday before and not the next workday?  I could need 2 days before and not only 1 day.  I dont know if it's as simple as changing a sign on the -1 and if you want 2 days before then change the 1 to a 2.

Here is the formula with an explanation from another expert (Barry Houdini)
=WORKDAY(EDATE(I34,CHOOSE(MATCH(D35,{"annually","quarterly","semi-annually","monthly"},0),12,3,6,1))-1,1)

<When the original formula gives you a weekend date that will jump to the next working day

Thank you.
0
Comment
Question by:pdvsa
  • 3
  • 2
6 Comments
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40428258
=WORKDAY(EDATE(I34,CHOOSE(MATCH(D35,{"annually","quarterly","semi-annually","monthly"},0),12,3,6,1))+1,-1)
0
 
LVL 50

Expert Comment

by:Rgonzo1971
ID: 40428267
Hi,

it should be

=WORKDAY(EDATE(I34,CHOOSE(MATCH(D35,{"annually","quarterly","semi-annually","monthly"},0),12,3,6,1))-1,-1)

Regards
0
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40428270
Rgonzo, that will change a Friday to a Wednesday. My code will keep a Friday to a Friday.

I'm assuming you want Sunday -> Friday, Saturday ->Friday, Friday ->Friday, Thursday->Thurday.
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:pdvsa
ID: 40428312
Philip, yes.  And what if it's 2 days before?  Please bold what is edited
0
 
LVL 24

Accepted Solution

by:
Phillip Burton earned 500 total points
ID: 40428319
Depends on what you mean.

If it's two working days before:

=WORKDAY(EDATE(I34,CHOOSE(MATCH(D35,{"annually","quarterly","semi-annually","monthly"},0),12,3,6,1))+0,-2)

This results in:

Mon      Thu
Tue      Fri
Wed      Mon
Thu      Tue
Fri      Wed
Sat      Thu
Sun      Thu

If it's two calendar days before, and then the previous working day, then

=WORKDAY(EDATE(I34,CHOOSE(MATCH(D35,{"annually","quarterly","semi-annually","monthly"},0),12,3,6,1))-1,-1)

This results in:
Mon      Fri
Tue      Fri
Wed      Mon
Thu      Tue
Fri      Wed
Sat      Thu
Sun      Fri
0
 

Author Closing Comment

by:pdvsa
ID: 40428451
thank you once again....
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question