Consulting

Results 1 to 6 of 6

Thread: Solved: Problems converting date into required format

  1. #1

    Solved: Problems converting date into required format

    Hi,

    I have the following date appearing in b3 of my sheet which comes from a web query: 01/05/2009

    However this date is incorrect and should actually be 09/05/2009. The actual date on the web page appears as 09 May - i.e it has no year specified hence this probably explains why the date is appearing how it is.
    I'm using the date function below to reconstruct the data into what it should be but it returns 03-Nov-2011.

    The date function syntax is:

    =DATE(2009,MID(B3,4,2),RIGHT(B3,2))

    Can anyone suggest if there's another way of getting what I need?

    Thanks,

    Nick

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Can't say that I know that this will work in all cases

    =DATEVALUE(2009&TEXT(B3,"\-yy\-mm"))
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Hi XLD,

    You're right, it doesn't work but it returns 05/09/2009 which is better than 03-Nov-2011!

    Nick

  4. #4
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,059
    Location
    =DATEVALUE(2009&TEXT(B3,"\-mm\-yy"))
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  5. #5
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Got it the wrong way around
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  6. #6
    Just tried switching the formula to =Datevalue(2009&Text(B3,"\-M-YY")) and this works!

Posting Permissions

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