Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Finding the Previous Work Day.

Finding the Previous Work Day

by Allen Wyatt
(last updated January 18, 2014)

5

Joe wonders how to return the date of the previous work day, taking into account any holidays. He needs to be able to get this information for any particular date.

Excel has a number of functions and formulas that help automate obtaining routine information. The Analysis ToolPak add-on contains formulas that can help with these automations. One is the WORKDAY function.

Assuming you have the Analysis ToolPak enabled (how you do so has been covered in other issues of ExcelTips), you can obtain the date information you need by using the following formula:

=WORKDAY(A1,-1,MyHolidays)

The first part of this formula, A1, refers to the cell where the reference date is located. This information can be obtained in a couple of different ways. You can manually enter the date into cell A1 or you could use a formula in that cell to signify the date. For instance, you could use the following simple formula in cell A1 so that it always contains today's date:

=TODAY()

The second part of the formula, -1, says to subtract one day from the date in A1. The third part of the formula, MyHolidays, refers to a named range containing a list of dates and holidays you want skipped in determining the previous workday.

The WORKDAY function returns the date of day previous to the date entered in A1, allowing for any holidays.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (8104) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Finding the Previous Work Day.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Understanding Hyphens and Dashes

Word provides you with three types of hyphens and two types of dashes that you can use in your documents. Understanding the ...

Discover More

Hiding and Unhiding Columns

Want to hide a column so it doesn't appear in the worksheet? It's easy to do using the formatting capabilities of Excel.

Discover More

Embedding Your Phone Number in a Document

One way you can designate your responsibility for a document is to add your phone number to it. There is no need to add your ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

MORE EXCELTIPS (MENU)

Calculating TV Time

In some industries it is necessary to work with time resolutions of less than a second. If you need to keep track of such ...

Discover More

Backwards Date Parsing

Enter information into a worksheet, and you come to anticipate (and count on) how Excel will interpret that information and ...

Discover More

Inserting the Current Time with Seconds

If you need to insert the current time, with seconds, then you'll need the macro discussed in this tip. It's easy to use and ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments for this tip:

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 7 + 8?

2015-05-18 11:18:14

BryanW

@stan try this:

=IF(WEEKDAY(A1,2)>5,WORKDAY(A1,-1,Holidays),IF(COUNTIF(Holidays,A1),WORKDAY(A1,-1,Holidays),A1))

I use a slightly modified one that moves the day to Monday if the day in question falls on a Sunday.

=IF(WEEKDAY(A1,2)=6,WORKDAY(A1,-1,Holidays),IF(WEEKDAY(A1,2)=7,WORKDAY(A1,1,Holidays),IF(COUNTIF(Holidays,A1),WORKDAY(A1,-1,Holidays),A1)))


2015-01-28 16:50:48

mike

Stan wanted the previous workday , only if the current day is a weekend or holdiday. the above solution doesn't give the same day as requitred for mon to fri.

this should work

workday(current date +1, -1, myholidays)


2014-04-08 12:02:10

Stan Lieberman

Micky - 0) Thank you for responding
1) Weenend days are Saturday and Sunday
2) Holiday dates are in a worksheet named "Holidays" in the same workbook where I want to create the formula.
3) If the date in cell A1 is not a weekend or holiday I want the result to be the same date that is already in cell A1. (As further explanation, I have a rule that says, "If the due date is on a weekend or holiday the due date changes to the last workday before the original due date").
Thank you for your help.
Stan - Los Angeles, CA - USA


2014-04-08 07:01:20

Michael (Micky) Avidan

@Stan,1) What R the Weekend day(s) in your region ?
2) where did U put the Holiday(s) date(s) ?
3) If the date, in cell A1, is not a weekend - what do you expect as a result ?
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” MVP – Excel (2009-2014)
ISRAEL


2014-04-07 13:01:35

Stan Lieberman

I'm looking for a formula that will give me the previous workday ONLY IF THE DATE (in cell A1) FALLS ON A WEEKEND OR HOLIDAY (HOLIDAY AS DEFINED BY ME). Is there a way to do this?
Thank you.


Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.

Links and Sharing
Share