+ Reply to Thread
Results 1 to 3 of 3

WeekdayName returning wrong values

  1. #1
    Registered User
    Join Date
    06-11-2009
    Location
    Berlin
    MS-Off Ver
    Excel 2003
    Posts
    63

    WeekdayName returning wrong values

    Hi guys
    I'm using weekdayname and constantly getting not the name of the actual weekday but the name of the next one. At first I thought it had something to do with the date format and the macro was reading 01.09.2009 not as September 1st 2009 but as January 9th 2009, however I soon discovered this was not the case.

    The same thing happens with the DatePart function

    Datepart ("w", Date) should return the value 2 for today (September 1st) but it's returning 3, just like weekdayname returns Wednesday and not Tuesday.

    How is this possible and what can I do (besides manually subtracting 1 from the result of the Datepart function and then using WeekdayName)

    Thanks
    Nick

  2. #2
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264

    Re: WeekdayName returning wrong values

    Specify which day the start of the week occurs on using the optional third argument of both DatePart and WeekDayName:

    Please Login or Register  to view this content.
    Richard
    Richard Schollar
    Microsoft MVP - Excel

  3. #3
    Registered User
    Join Date
    06-11-2009
    Location
    Berlin
    MS-Off Ver
    Excel 2003
    Posts
    63

    Re: WeekdayName returning wrong values

    I thought I had tried that ... but obviously I hadn't.
    Thanks for the help, it worked!

+ 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