Calculate week end for week starting on saturday

mrugesh

Board Regular
Joined
Aug 23, 2010
Messages
67
Hi,

Can someone please help me out with a formula to calculate week end where saturday is the first day of week? For example, if date displayed in cell A1 is between 17th December till 23rd December, the week ending date displayed should be 23rd December.

Formula given below was perfect when sunday was first day of week. Now it does not work. I suspect the weekday function is to be blamed here... :)

=A1+-(WEEKDAY(A1)-1)+6

Regards,
Mrugesh.
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
The difference is how it handles Saturday.

Excel considers Saturday the end of the week, so therefore when WEEKDAY is used, it gives it a number of 7, which would would indicate the end.

However, if we think of a week as a "container" that is filled by 7 days, by the time we hit Saturday excel considers the week "full" week, so when we use the MOD function to find the remainder, there is no remainder since the week is full.

Basically, all that is happening is that the starting point of the range is changing as the two formulas will return identical results for any day but Saturday.

Assuming A1 is December 10th:

=WEEKDAY(A1) is 7
=MOD(A1,7) is 0

We're basically changing the weekday count from 1-7 (Sun-Sat) to 0-6 (Sat - Fri). That one day offset is all that was needed.
 
Upvote 0
Because the MOD version works on the dateserial number that version will only work if 1900 date system is being used - if you change to 1904 date system then that formula will return a Thursday. For that reason I would always use WEEKDAY function, i.e. for Friday week ending date try

=A1+7-WEEKDAY(A1+1)

That version can be adjusted for any day of the week, +2 is Thursday, +3 is Wednesday etc.
 
Upvote 0
Because the MOD version works on the dateserial number that version will only work if 1900 date system is being used - if you change to 1904 date system then that formula will return a Thursday. For that reason I would always use WEEKDAY function, i.e. for Friday week ending date try

=A1+7-WEEKDAY(A1+1)

That version can be adjusted for any day of the week, +2 is Thursday, +3 is Wednesday etc.
@ Barry: Pure awesomeness!!! :D

You have just saved me a lot of grief. The data which I'm handling requires 1904 date system to be used in case of negative time values occur.
 
Upvote 0

Forum statistics

Threads
1,226,587
Messages
6,191,878
Members
453,684
Latest member
Gretchenhines

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