Please Note: This article is written for users of the following Microsoft Excel versions: 2007 and 2010. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Date for Next Wednesday.
Sam has a date in cell A1 and he would like to calculate the date of the following Wednesday in cell B1. He wonders what formula he should use for the calculation.
There are actually many formulas you can use, and the one you pick is pretty much up to you. Here is a good representative sampling of formulas you can use:
=IF(WEEKDAY(A1)<=4,A1+4-WEEKDAY(A1),A1+11-WEEKDAY(A1)) =A1+WEEKDAY(A1, 1)+CHOOSE(WEEKDAY(A1, 1), 2, 0, -2, -4, 1, -1, -3) =A1+CHOOSE(WEEKDAY(A1),3,2,1,0,6,5,4) =A1-MOD(WEEKDAY(A1)-5,7)+6 =A1+MOD(4-WEEKDAY(A1),7)
These formulas return a date that represents next Wednesday, provided that the date in cell A1 isn't a Wednesday to begin with. For instance, if the date in A1 is 5/26/10 (a Wednesday), then each of these will return 5/26/10. However, if the date is 5/27/10 then the formula returns 6/2/10.
If you want a formula that will return the next Wednesday even when the starting date is a Wednesday, then you should rely on a different formula. Choose from one of these:
=A1+IF(WEEKDAY(A1,1)=4,7,IF(WEEKDAY(A1,1)<4,4-WEEKDAY(A1,1),11-WEEKDAY(A1,1))) =IF(WEEKDAY(A1)<4,A1+4-WEEKDAY(A1),A1+11-WEEKDAY(A1)) =IF(WEEKDAY(A1)=4,A1+7,A1+MOD(4-WEEKDAY(A1),7)) =A1+MOD(4-WEEKDAY(A1),7)+7*(0=MOD(4-WEEKDAY(A1),7)) =A1+7-MOD(4+WEEKDAY(A1,2),7) =A1+4-WEEKDAY(A1)+IF(WEEKDAY(A1)<4,0,7) =A1+CHOOSE(WEEKDAY(A1),3,2,1,7,6,5,4) =A1+(7-MOD(WEEKDAY(A1,3)-2,7)) =A1+4-WEEKDAY(A1)+7*(WEEKDAY(A1)>=4) =A1-MOD(WEEKDAY(A1)-4,7)+7 =A1+4+((WEEKDAY(A1)>=4)*7)-WEEKDAY(A1) =A1+MOD(10-WEEKDAY(A1),7)+1 =A1+IF(WEEKDAY(A1) < 4,4,11)-WEEKDAY(A1) =CEILING(A1-4,7)+4 =A1+6-MOD(A1+2,7)
It should be noted that the last two of these formulas works just fine on the PC but won't work as expected on the Mac. This is because the basis date used for date serial numbers is different on the Mac than it is on the PC, and thus the computations—which operate on the underlying serial numbers for the dates—return different values on each platform.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (8625) applies to Microsoft Excel 2007 and 2010. You can find a version of this tip for the older menu interface of Excel here: Date for Next Wednesday.
Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!
You can use a couple of different worksheet functions to enter today's date in a cell. What if you want to calculate ...
Discover MoreEveryone seems to determine the difference between dates differently. Nicole has a need to calculate contact weeks (the ...
Discover MoreIf you need to know the years in which a particular date occurred on a specific day of the week, there are a number of ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2023-01-25 10:55:27
Sarah
I wanted to find the Wednesday previous to the date in the selected cell so in
=A1+IF(WEEKDAY(A1,1)=4,7,IF(WEEKDAY(A1,1)<4,4-WEEKDAY(A1,1),11-WEEKDAY(A1,1)))
so I changed it to -7 and it shows the previous Wednesday.
Thanks for sharing the formulas, it saved me a bunch of typing and looking up dates
Regards
2017-08-23 01:48:24
Agnius
Hi Alan,
You should probably also note that these formulas are constructed in such a way that it works with calendars where the first day of the week is Sunday, rather than Monday. The 4 in most cases should be changed into a 3 to work with the European way of starting a week on Mondays.
2017-08-17 04:04:38
Andries Olivier
Hi Allan
The last two formulas does not work =CEILING(A1-4,7)+4 ,=A1+6-MOD(A1+2,7) both return the same Wednesday date that appears in A1.
Regards
Andries
2017-08-17 03:57:53
Henk
Hi Allen,
What about?:
=IF(WEEKDAY(A1)=4,A1+7,A1+7-WEEKDAY(A1+7-4))
Regards
2017-08-17 03:30:58
Henk
Hi Allen,
All three of the following formulas give incorrect results:
=CEILING(A1-4,7)+4
=A1+6-MOD(A1+2,7)
=CEILING(A1-3,7)+4
Test for 15 and 16 Aug 2017, a Tuesday and a Wednesday.
Regards
2016-02-05 10:23:11
chris
How about a formula that gives me the next Thursday, however if today is a Thursday, show me today?
I have =Today() in A1
Thanks in anticipation
2014-03-01 07:18:13
Russell Gorton
I think that this formula:
=CEILING(A1-4,7)+4
should read:
=CEILING(A1-3,7)+4
if it is intended that a Wednesday starting date will return the next Wednesday.
2013-11-11 08:32:36
Bryan
You've given me 15 formulas to choose from (I'm not counting the first 5, since you already stated they don't solve the problem satement); which one should I use and why? Is there any reason to not use the shortest one (other than the fact that it doesn't seem to work as described)?
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments