+ Reply to Thread
Results 1 to 4 of 4

Change number to date

  1. #1
    Registered User
    Join Date
    03-13-2007
    Posts
    1

    Change number to date

    Hi,

    I have a problem, i am currently importing data to my excel spreadsheet through ODBC, this is not a problem and it works fine however the date i am getting is shown as 90307 which everyone knows is 09/03/2007 or 9th March 2007. (UK Date)

    I have tried changing this to a date format but i am getting this 2147-04-01! I can't find a way for making 90307 to be 09/03/07!

    Can anyone help? i need a simple way of doing this as i will be recording a macro to do it.

    Thanks

    Sion

  2. #2
    Forum Contributor
    Join Date
    03-14-2006
    Location
    Pakistan
    Posts
    1,791

    Lightbulb

    Quote Originally Posted by sioncleverly
    Hi,

    I have a problem, i am currently importing data to my excel spreadsheet through ODBC, this is not a problem and it works fine however the date i am getting is shown as 90307 which everyone knows is 09/03/2007 or 9th March 2007. (UK Date)

    I have tried changing this to a date format but i am getting this 2147-04-01! I can't find a way for making 90307 to be 09/03/07!

    Can anyone help? i need a simple way of doing this as i will be recording a macro to do it.

    Thanks

    Sion
    Hi
    if your data is in A1 put in B1
    =DATE(RIGHT(A1,2),IF(LEN(A1)=5,MID(A1,2,2),MID(A1,3,2)),IF(LEN(A1)=5,MID(A1,1,1),MID(A1,1,2)))
    and format cell as Date (it will only show year as 07 not 2007)

    hope this would serve your purpose.

  3. #3
    Valued Forum Contributor
    Join Date
    12-16-2004
    Location
    Canada, Quebec
    Posts
    363
    Hi

    Same result different flavor
    Please Login or Register  to view this content.
    Denis

    Please always attach the sample workbook without sensitive information when asking for help

    To add a module
    Press Alt + F11 (this is the Visual Basic Environment)
    Insert Menu, select Module
    Past code there
    Close Visual Basic Environment (X)

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,736
    With a formula.....

    =TEXT(A1,"00-00-00")+0

+ 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