Changing any Weekday to a Specific Weekday

miyengar

Board Regular
Joined
Jun 22, 2012
Messages
54
Here's my problem: I'm looking for a formula to change a weekday in the previous month - the day that is 30 days from a day in this month - to a Monday of the following week, if it's a weekday oother than a Monday. For example, if 30 days from the current month (June) is May 24, 2012 (Thursday), I want the formula result to show May 28, 2012 (next Monday). Greatly appreciate any help!
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Here's my problem: I'm looking for a formula to change a weekday in the previous month - the day that is 30 days from a day in this month - to a Monday of the following week, if it's a weekday oother than a Monday. For example, if 30 days from the current month (June) is May 24, 2012 (Thursday), I want the formula result to show May 28, 2012 (next Monday). Greatly appreciate any help!
Maybe this...

A2 = some date

=A2-30+CHOOSE(WEEKDAY(A2-30),1,0,6,5,4,3,2)
 
Upvote 0
Again, thanks! Small request: would you explain the formula, especially the "Choose" part and the numbers that follow? Thanks!
 
Upvote 0
Again, thanks! Small request: would you explain the formula, especially the "Choose" part and the numbers that follow? Thanks!
Here ya go...

A2 = some date

=A2-30+CHOOSE(WEEKDAY(A2-30),1,0,6,5,4,3,2)

You want the date for the next Monday if the date minus 30 days is already not a Monday.

We get the date:

A2-30

Then we test what weekday that is:

WEEKDAY(A2-30)

That will return a number from 1 to 7 where:

1 = Sunday
2 = Monday
3= Tuesday
4 = Wednesday
5 = Thursday
6 = Friday
7 = Saturday

We then use that number to CHOOSE how many days we need to add to the date, A2-30, to give us the next Monday date.

Weekday 1 (Sunday) add 1 day
Weekday 2 (Monday) add 0 days
Weekday 3 (Tuesday) add 6 days
Weekday 4 (Wednesday) add 5 days
Weekday 5 (Thursday) add 4 days
Weekday 6 (Friday) add 3 days
Weekday 7 (Saturday) add 2 days
 
Upvote 0

Forum statistics

Threads
1,215,071
Messages
6,122,963
Members
449,094
Latest member
Anshu121

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