+ Reply to Thread
Results 1 to 6 of 6

Data Format

  1. #1
    Registered User
    Join Date
    04-17-2009
    Location
    Redditch
    MS-Off Ver
    Excel 2003
    Posts
    36

    Data Format

    Hello,

    Every day i extract data from one of our systems and i have to enter it into an excel document and format it. I want to create a macro to make all of the changes for me but there is one section i am stuck on.

    In one of my columns i have a date and time however it is layed out like:

    2009-04-16-08:45:52
    2009-04-15-13:12:10

    How can i remove the - between the date and time without doing it manually?

    Any help would be much appreciated

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,644

    Re: Data Format

    =replace(d8;11;1;" ")

  3. #3
    Registered User
    Join Date
    04-17-2009
    Location
    Redditch
    MS-Off Ver
    Excel 2003
    Posts
    36

    Re: Data Format

    Thanks Zbor but once it has been replaced i then have to format the data into into date format dd/mm/yyyy which does not work.

  4. #4
    Forum Contributor mubashir aziz's Avatar
    Join Date
    03-18-2009
    Location
    Lahore, Pakistan
    MS-Off Ver
    MS Office 2013
    Posts
    533

    Re: Data Format

    i think you are not clear about your requirements if you want date format from dd-mm-yy to dd/mm/yy then simply change it from

    Format > Cell > Number > Date

    Now select the different date format

    or do it Format > Cell > Number > Custom and in Type write dd/mm/yy.

  5. #5
    Registered User
    Join Date
    04-17-2009
    Location
    Redditch
    MS-Off Ver
    Excel 2003
    Posts
    36

    Re: Data Format

    Mubashir as stated in my first post the data is set out like 2009-04-22-08:15:03 so i cannot format the cells into a date format as the - between the date and time is stopping it.

    The replace formula removed the - however i was still unable to format the cell.

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Data Format

    with that in column A starting in A1 then in b1 =DATEVALUE(LEFT(A1,10)) format cell dd/mm/yy
    and C1 =TIMEVALUE(RIGHT(A1,8)) format cells HH:mm:ss
    or simply combine them in b1
    put

    =DATEVALUE(LEFT(A1,10))+TIMEVALUE(RIGHT(A1,8)) format cell dd/mm/yy HH:mm:ss
    Last edited by martindwilson; 04-23-2009 at 06:21 AM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

+ 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