+ Reply to Thread
Results 1 to 12 of 12

Always making the date the previous sunday.

  1. #1
    Registered User
    Join Date
    10-25-2007
    Posts
    85

    Always making the date the previous sunday.

    Is there a way to make the date in a cell check the current date then fall back to the previous sunday unless today actually happens to be sunday? So for example it would look at today and make the date 12/9/2007 rather than 12/14/2007

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    =today()-weekday(today())+1
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  3. #3
    Registered User
    Join Date
    10-25-2007
    Posts
    85
    That works perfectly, thank you very much.

  4. #4
    Registered User
    Join Date
    12-17-2007
    Posts
    4
    How would I correct the formula so that the cell would always present the date as the next Sunday unless it is Sunday? I'm trying on my own but I'm a bit of a newbie...
    Last edited by Superhatch; 12-17-2007 at 11:18 AM.

  5. #5
    Registered User
    Join Date
    12-17-2007
    Posts
    4
    =TODAY()+WEEKDAY(TODAY())+4 works for this week, but I'm not sure why, or if it will work for next week, any correction or explanation would be greatly appreciated.

  6. #6
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Try this,

    =TODAY()+7-WEEKDAY(TODAY())+1
    oldchippy
    -------------


    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  7. #7
    Registered User
    Join Date
    12-17-2007
    Posts
    4
    I did a litte research, and found how weekday, and dates work. So that formula makes sense to me now Thanks much for the help!!

  8. #8
    Registered User
    Join Date
    12-17-2007
    Posts
    4
    =TODAY()+7-WEEKDAY(TODAY())+1

    Just for clarification...if I calculate out this coming Sunday..the formula would be 23rd+7=30-1+1...that would equal the 30th. I've read about how excel serializes Sunday-Saturday as 1-7, but if you add the today # on a Sunday you get the 30th which would be the following Sunday. Does (TODAY()) compensate for that somehow?

  9. #9
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    If the day is Sunday and you want this Sunday then

    =IF(WEEKDAY(TODAY())=1,TODAY(),TODAY()+7-WEEKDAY(TODAY())+1)

  10. #10
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    A small variation to oldchippy's formula

    =IF(WEEKDAY(TODAY())=1,TODAY(),TODAY()-WEEKDAY(TODAY())+8)

  11. #11
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    Quote Originally Posted by Superhatch
    =TODAY()+7-WEEKDAY(TODAY())+1
    This is close....just change to

    =TODAY()+7-WEEKDAY(TODAY()-1)

  12. #12
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    daddylonglegs

    Thats much neater than using If

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1