Non-holiday workday nearest to a given date

Texas Longhorn

Active Member
Joined
Sep 30, 2003
Messages
493
Hi all,

I'm trying to calculate one year stock returns for various stock symbols in a spreadsheet that updates generally daily. My company has a vendor that supplies an add-in that allows us to pull historical stock prices into excel by using a function that references a date in a cell. The problem is, if the reference date is a date on which the market was closed (i.e. weekend or US holiday), then I receive an error. Currently, my historical date is found via =TODAY()-364.

Is there a way to have Excel return the non-holiday/non-weekend day closest to TODAY()-364?

Thanks for any help,
Bill
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hello Texas Longhorn.

Do you really want the closest date, i.e. it could be earlier or later than TODAY()-364?

If you wanted the first workday BEFORE (when TODAY()-364 is not a workday) you could try using the WORKDAY function from Analysis ToolPak add-in, i.e.

=WORKDAY(TODAY()-363,-1,holidays)

where holidays is a named range containing a list of your holiday dates
 
Upvote 0

Forum statistics

Threads
1,214,593
Messages
6,120,434
Members
448,961
Latest member
nzskater

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