Weekday shows the wrong day
Results 1 to 5 of 5

Thread: Weekday shows the wrong day
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular
    Join Date
    Oct 2010
    Location
    Athens Greece
    Posts
    218
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Weekday shows the wrong day

    Hello everybody,

    Back again after sooo long

    I am facing a problem with the weekday function that after a bit of googling I saw that is a common question but I couldn't find an answer.

    Say in cell A1 there is the date 10-01-2019 which is a Thursday
    Code:
    =weekday(A1,1) gives a 5 (correct). Applying custom formatting "dddd" is a Thursday (correct)
    but

    Code:
    =weekday(A1,2) gives a 4 (correct). Applying custom formatting "dddd" is a Wednesday (false)
    Could you explain me the logic behind this behavior and how to overcome this?

    PS: I changed at the region settings the "First Day of week" text box to be a Monday but still doesn't work

    Thank you!
    George

  2. #2
    MrExcel MVP
    Moderator
    Scott Huish's Avatar
    Join Date
    Mar 2004
    Location
    Oregon
    Posts
    19,739
    Post Thanks / Like
    Mentioned
    5 Post(s)
    Tagged
    4 Thread(s)

    Default Re: Weekday shows the wrong day

    Weekday doesn't return a date, so I don't quite get why you are formatting it as a date format (dddd)

    The logic is dates are just numerical sequences starting from Jan 1, 1900. So 5 would be January 5, 1900 Thursday, while 4 would be Janary 4, 1900 Wednesday.

    So the question is what are you trying to accomplish exactly?
    Last edited by Scott Huish; Jan 14th, 2019 at 05:37 PM.
    Office 2010/365

  3. #3
    Board Regular
    Join Date
    Oct 2010
    Location
    Athens Greece
    Posts
    218
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Weekday shows the wrong day

    Quote Originally Posted by Scott Huish View Post
    Weekday doesn't return a date, so I don't quite get why you are formatting it as a date format (dddd)

    The logic is dates are just numerical sequences starting from Jan 1, 1900. So 5 would be January 5, 1900 Thursday, while 4 would be Janary 4, 1900 Wednesday.

    So the question is what are you trying to accomplish exactly?
    Hello Scott,

    Thank you for your answer. As far as the logic part is concerned its clear now, thanks.
    What I am trying to accomplish is to get the weekday out of a date and show the day in text format, which also the

    Code:
     =TEXT(WEEKDAY(A1,2),"dddd")
    doesn't seem to do it.

    George

  4. #4
    MrExcel MVP Rick Rothstein's Avatar
    Join Date
    Apr 2011
    Location
    New Jersey, USA
    Posts
    35,116
    Post Thanks / Like
    Mentioned
    92 Post(s)
    Tagged
    33 Thread(s)

    Default Re: Weekday shows the wrong day

    Quote Originally Posted by GK039 View Post
    Hello Scott,

    Thank you for your answer. As far as the logic part is concerned its clear now, thanks.
    What I am trying to accomplish is to get the weekday out of a date and show the day in text format, which also the

    Code:
     =TEXT(WEEKDAY(A1,2),"dddd")
    doesn't seem to do it.
    You do not need to use the WEEKDAY function as the TEXT function can work with dates directly. Try it this way...

    =TEXT(A1,"dddd")
    Rick's "mini" blog... http://www.excelfox.com/forum/f22/
    .
    Want to post a small screen shot? See Part B here.

  5. #5
    Board Regular
    Join Date
    Oct 2010
    Location
    Athens Greece
    Posts
    218
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Weekday shows the wrong day

    Quote Originally Posted by Rick Rothstein View Post
    You do not need to use the WEEKDAY function as the TEXT function can work with dates directly. Try it this way...

    =TEXT(A1,"dddd")
    Thank you Rick. I thought the TEXT function could work in conjunction with the WEEKDAY function as well.
    It's clear now.
    George

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •