# Return Friday before or equal to referenced date

1. ## 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

2. ## 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."

3. ## Re: Return Friday before or equal to referenced date

``Please Login or Register  to view this content.``

4. ## Re: Return Friday before or equal to referenced date

Thanks guys, worked a treat!

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

#### 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