+ Reply to Thread
Results 1 to 11 of 11

check previous weekday date based on a specific dates

  1. #1
    Valued Forum Contributor
    Join Date
    12-01-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2016
    Posts
    949

    check previous weekday date based on a specific dates

    hi,

    specific dates of 7,14, 22 and the last day of the month

    rules for the above dates
    1. if the specific date is a Friday-Saturday-Sunday the previous weekday date will be Thursday
    2. if the specific date is a Thursday previous weekday date will be Wednesday
    3. if the specific date is a Wednesday previous weekday date will be Tuesday
    4. if the specific date is a Tuesday previous weekday date will be Monday
    5. if the specific date is a Monday previous weekday date will be Friday

    example for April 2018

    7 is on Saturday so display on A1 "The previous weekday is 5-Thursday"
    then the actual date on B1 "04/05/18"

    14 is on Saturday so display on A2 "The previous weekday is 12-Thursday"
    then the actual date on B2 "04/12/18"

    22 is on Sunday so display on A3 "The previous weekday is 19-Thursday"
    then the actual date on B3 "04/19/18"

    30(last day of Apr 2018) is on Monday so display on A4 "The previous weekday is 27-Friday"
    then the actual date on B4 "04/27/18"

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,444

    Re: check previous weekday date based on a specific dates

    Where are the dates being typed? Why does this need to be a VBA solution?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,591

    Re: check previous weekday date based on a specific dates

    Quote Originally Posted by k1dr0ck View Post
    specific dates of 7,14, 22 and the last day of the month
    Please Login or Register  to view this content.

  4. #4
    Valued Forum Contributor
    Join Date
    12-01-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2016
    Posts
    949

    Re: check previous weekday date based on a specific dates

    hi,

    thanks for the replies

    @aligw
    i was thinking of also posting this in the formula forums
    but i think its not allowed to post same question in different forums

    @jindon
    i moved the dates column B
    how do i show the string "The previous weekday is 5-Thursday" on A1
    and also for the other 3 dates
    im guessing it will be on the line with the blue font color below

    Please Login or Register  to view this content.

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,591

    Re: check previous weekday date based on a specific dates

    Quote Originally Posted by k1dr0ck View Post
    @jindon
    i moved the dates column B
    how do i show the string "The previous weekday is 5-Thursday" on A1
    and also for the other 3 dates
    What do you mean?
    The code will put the "previous weekday" for 7, 17, 22 and end of month of current month.

    If it is not what you want, upload a workbook with before/after.

  6. #6
    Valued Forum Contributor
    Join Date
    12-01-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2016
    Posts
    949

    Re: check previous weekday date based on a specific dates

    hi,

    attached file
    Attached Files Attached Files

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,444

    Re: check previous weekday date based on a specific dates

    but i think its not allowed to post same question in different forums
    It isn't, but you could have steted "Formula or VBA" in your thread title.

  8. #8
    Valued Forum Contributor
    Join Date
    12-01-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2016
    Posts
    949

    Re: check previous weekday date based on a specific dates

    *double post
    Last edited by k1dr0ck; 04-26-2018 at 03:12 AM. Reason: double post

  9. #9
    Valued Forum Contributor
    Join Date
    12-01-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2016
    Posts
    949

    Re: check previous weekday date based on a specific dates

    i see, thanks for the tip

    Quote Originally Posted by AliGW View Post
    It isn't, but you could have steted "Formula or VBA" in your thread title.

  10. #10
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,591

    Re: check previous weekday date based on a specific dates

    Is this what you want?
    Please Login or Register  to view this content.

  11. #11
    Valued Forum Contributor
    Join Date
    12-01-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2016
    Posts
    949

    Re: check previous weekday date based on a specific dates

    yup, thats it!, thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Calculate weekday end date based on sum of weekday start date and cell value
    By Rerock in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-01-2014, 09:17 AM
  2. [SOLVED] vba code to open excel file name in previous weekday date
    By prabhuduraraj09 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-23-2014, 05:09 PM
  3. Replies: 0
    Last Post: 05-30-2013, 07:50 PM
  4. How to check which weekday the date is and how to use it with calculation
    By rain4u in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-16-2011, 10:40 PM
  5. Replies: 2
    Last Post: 02-02-2011, 06:47 AM
  6. Round Down Dates to Specific Weekday
    By torresk in forum Excel General
    Replies: 7
    Last Post: 05-05-2010, 02:10 PM
  7. [SOLVED] Updating Dates to Next Specific Weekday Automatically
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-10-2006, 07:30 PM

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