Subtract Saturday, Sunday, & Monday

Blue1823

New Member
Joined
Dec 6, 2009
Messages
4
In Microsoft Excel, I would like to subtract Saturday, Sunday, & Monday from the days of the week and still have the formula give me a calculated day. Right now I have a WEEKDAY formula that calculates 29 days subtracted from a final date (i.e. January 22, 2010 - 29 --> final answer Dec 15, 2009) but excluding weekends (Sat & Sun) & Mon...I'm not sure how to utilize that formula or one similar to also subtract Mondays.

I'm using Excel 2007. :confused:
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Welcome to the forum.

You could use a formula like =WORKDAY(A2,-29,Holidays)

The named range "Holidays" includes all holidays including Mondays.
 
Upvote 0
Dave, thx for your help. So I have to list all the Mondays in my range? There's no simple way less script writing to eliminate Mondays from formula?
 
Upvote 0
Assuming you have the date in A2 (e.g. 22-Jan-2010) and number of days to subtract (e.g. 29) in B2 then you can use this formula

=A2-SMALL(IF(ISNA(MATCH(WEEKDAY(A2-ROW(INDIRECT("1:"&B2*5))),{1,2,6},0)),ROW(INDIRECT("1:"&B2*5))),B2)

confirmed with CTRL+SHIFT+ENTER
 
Upvote 0
Dave, thx for your help. So I have to list all the Mondays in my range? There's no simple way less script writing to eliminate Mondays from formula?

Also, it's VERY easy to create a list of mondays.....

Just type the date of the first monday in say A1,
Then in A2 put
=A1+7
and fill down as far as you'd like.
There's your list of mondays
 
Upvote 0
@ barry houdini...your formula worked although I sat in front of my computer for a minute trying to figure out how the heck you came up with it and what each part meant, but I couldn't. Could you explain what's what? Does the 1 represent Monday?
 
Upvote 0
@ barry houdini...your formula worked although I sat in front of my computer for a minute trying to figure out how the heck you came up with it and what each part meant, but I couldn't. Could you explain what's what? Does the 1 represent Monday?
 
Upvote 0
You can try using Excel's built in Formula Evaluation.
I would test and review the results with a small number say 3 or 4.
You should be able to visualize each part of the formula.
 
Upvote 0
Sorry, formula should be

=A2-SMALL(IF(ISNA(MATCH(WEEKDAY(A2-ROW(INDIRECT("1:"&B2*5))),{1,2,7},0)),ROW(INDIRECT("1:"&B2*5))),B2)

otherwise it excludes Fridays rather than Saturdays (thanks for pointing that out, Dave, good call)

To explain briefly......this part

=ROW(INDIRECT("1:"&B2*5))

builds an array of digits 1 to n based on the value in B2, e.g. if B2 is 3 you get

{1;2;3;4;5;6;7;8;9;10;11;12;13;14;15}

5 is a somewhat arbitrary number, it needs to be at least 4 for the case where B2 = 1 and A2 is a Tuesday......

That array is then subtracted from A2 to give you an array of dates, the last 15 before A2 in my example.

WEEKDAY is then used to ascertain the weekday of those dates and those that don't match {1,2,7} 1 = Sun, 2 = Mon, 7 = Sat are effectively discarded and SMALL is used to take the B2th smallest date out of the others, i.e. the Tuesdays, Wednesdays, Thursdays and Fridays, hence giving the final result
 
Last edited:
Upvote 0

Forum statistics

Threads
1,222,828
Messages
6,168,484
Members
452,193
Latest member
Arlochorim

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