+ Reply to Thread
Results 1 to 4 of 4

Return Friday before or equal to referenced date

  1. #1
    Forum Contributor
    Join Date
    10-09-2012
    Location
    Adelaide, South Australia
    MS-Off Ver
    Excel 2010
    Posts
    135

    Return Friday before or equal to referenced date

    Hello,
    I have gone back and forth trying to work out the WEEKDAY function in excel and I'm still pretty confused.
    ok, I want to return the friday before or equal to a referenced date.

    so if I have 28/2/14 (Friday) in A1 it will return 28/2/14
    but if I have 27/2/14 (Thursday) in A1 it will return 21/2/14

    Please help

  2. #2
    Registered User
    Join Date
    03-13-2014
    Location
    New York, NY
    MS-Off Ver
    Excel 2010
    Posts
    30

    Re: Return Friday before or equal to referenced date

    This may be a more complicated function than is necessary, but it should work:


    =IF(TEXT(A1,"ddd")="Mon",A1-3,IF(TEXT(A1,"ddd")="Tue",A1-4,IF(TEXT(A1,"ddd")="Wed",A1-5,IF(TEXT(A1,"ddd")="Thur",A1-6,IF(TEXT(A1,"ddd")="Fri",A1,IF(TEXT(A1="ddd")="Sat",A1-1,IF(TEXT(A1="ddd")="Sun",A1-2,"ERROR")))))))

    Basically, what it's doing is saying: Check A1. If the date is a Monday, then subtract 3 days from it. If it isn't a Monday, then check to see if it is a Tuesday. If it's a Tuesday, subtract 4 days from it. If it's not a Tuesday...blablabla...check to see if it's a Friday, if it is, just return the same date. If it's not a Friday...blablabla...check to see if it's a Sunday. If it's a Sunday, subtract 2 days from it. If it's not a Sunday, then just return the word "ERROR" because you have something in A1 that does not correspond to any day of the week.

    Make sure that whatever cell you put this function in is set as "Short Date" or "Long Date."
    Last edited by wes228; 06-17-2014 at 10:33 PM.

  3. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,598

    Re: Return Friday before or equal to referenced date

    Please Login or Register  to view this content.
    Ben Van Johnson

  4. #4
    Forum Contributor
    Join Date
    10-09-2012
    Location
    Adelaide, South Australia
    MS-Off Ver
    Excel 2010
    Posts
    135

    Re: Return Friday before or equal to referenced date

    Thanks guys, worked a treat!

+ 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. Replies: 9
    Last Post: 12-19-2012, 01:06 AM
  2. [SOLVED] Return a weekending date on a Friday
    By KiwiMyg in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-15-2012, 07:53 PM
  3. [SOLVED] Return a Date of the Following Friday
    By FranksView in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-31-2012, 01:02 AM
  4. Return Friday's Date - Of the Week Prior to selected date
    By JonesZoid in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-12-2012, 09:19 AM
  5. Formula return following Wednesday or Friday date.
    By mikeburg in forum Excel General
    Replies: 11
    Last Post: 06-30-2010, 02:04 PM

Tags for this Thread

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