If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
How do I covert a week # to a Friday's date in a mm/dd/yy format?
|
#2
|
|||
|
|||
"=?Utf-8?B?emlla2k=?=" wrote in
: I have the dates coverted to week numbers so I can compare last year's data to this year's data. But now, for some new reports I'm creating, I need to convert a week number to a Friday's date. i.e. Week 2 = 1/14/2005 It seems that everyone and his dog has a different algorithm for defining weeknumbers, but this one seems to work for the n'th Friday after 01/01/xxxx -- Public Sub Friday(WeekNum As Integer, YearNum As Integer) Dim dtTemp As Date Dim wOffset As Integer wOffset = Weekday(DateSerial(YearNum, 1, 1)) If wOffset = 7 Then wOffset = 0 dtTemp = DateSerial(YearNum, 1, 7 * WeekNum - wOffset) Debug.Print Format(dtTemp, "dddd, dd/mm/yyyy") End Sub Hope it helps Tim F |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Not Allow Date Past This Thursday | Dave Elliott | Using Forms | 4 | November 1st, 2004 09:39 PM |
Grouping by date - How To: Show the first day of the week instead of the first date entered in that week... | Neil | Setting Up & Running Reports | 4 | October 8th, 2004 10:56 AM |
QDE (Quick Date Entry) | Norman Harker | Worksheet Functions | 37 | September 5th, 2004 01:24 AM |
Formula to return Friday's date: m/d/yyyy | Austin M. Horst | Worksheet Functions | 6 | April 24th, 2004 04:15 PM |