Find the previous Mon or Wed from a given Date

JustHooch

New Member
Joined
May 17, 2018
Messages
44
I need to find the Monday or Wednesday prior to a given date minus 4 days weekdays in order to Calculate a submission date.

Examples:
  • Date given is 7/31, then I want to return 7/23/18
  • Date given is 7/26, then I want to return 7/18/18
  • Date given is 7/25, then I want to return 7/18/18

I have been looking around but I can't find that fits my need. I know I need to use WEEKDAY and CHOOSE might be helpful but that is about how far I have gotten.
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
perhaps this....

=A1-(WEEKDAY(A1,2)+VLOOKUP(WEEKDAY(A1,2),{1,7;2,6;3,5;4,4;5,3;6,2;7,1},2,0))

first try this formula, if it works then I will explain how it works.

put date in column "A" and paste this formula in columnB
 
Upvote 0
Actually, the formula form Post # 4 can be shortened further to

=MAX(WORKDAY.INTL(A1-6,-1,{"0111111","1101111"}))
 
Upvote 0
Thank you both very much. I decided to go with Tetra201 formula since it was simpler. It works perfectly. Can you explain to me how it is working? I love to have a better understanding of the mechanics.
 
Upvote 0
You are welcome.

Here is how it works:
WORKDAY.INTL(A1+1,-1,"0111111") returns the previous Monday for the date in cell A1 (7/30/18 for 7/31/18)
WORKDAY.INTL(A1+1,-1,"1101111") returns the previous Wednesday for the date in cell A1 (7/25/18 for 7/31/18)
WORKDAY.INTL(A1+1,-1,{"0111111","1101111"}) returns a two-element array, namely {previous_Monday,previous_Wednesday}
MAX(WORKDAY.INTL(A1+1,-1,{"0111111","1101111"})) returns the date that is closest to the date in cell A1 (7/30/18 for 7/31/18)
WORKDAY(MAX(WORKDAY.INTL(A1+1,-1,{"0111111","1101111"})),-5) pushes it back by 5 working days (7/23/18 for 7/31/18)
Since 5 working days is 7 calendar days, the formula can be simplified to MAX(WORKDAY.INTL(A1-7+1,-1,{"0111111","1101111"})), or

=MAX(WORKDAY.INTL(A1-6,-1,{"0111111","1101111"}))
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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