+ Reply to Thread
Results 1 to 4 of 4

export file from txt (Notepad)

  1. #1
    shital shah
    Guest

    export file from txt (Notepad)

    Hi to all

    I have open exported file of notepad (TXT Format) Where i have data like
    date, item,amtin,amtout,bal.
    where data format is DD-MM-YYYY (05-01-2005)
    the problem is when i conver this data from text to column, date comes in
    number format like 20050105.

    is there any way i can put seprater(-) after 4 character and than after 2
    charcter (like 2005-01-05 )
    any help

    Thanks

    Shital shah


  2. #2
    Valued Forum Contributor
    Join Date
    07-11-2004
    Posts
    851
    you can convert your text to date via this (text in a8)

    =DATEVALUE(CONCATENATE(LEFT(TEXT(A8,0),4),"-",RIGHT(LEFT(TEXT(A8,0),6),2),"-",RIGHT(TEXT(A8,0),2)))
    not a professional, just trying to assist.....

  3. #3
    Sharad Naik
    Guest

    Re: export file from txt (Notepad)

    Hello Shital

    Assign the Date read from the txt file to a variable.
    In below example I assume that you assigned it to variable name "xyz". You
    can replace xyz with your variable.

    'You already assigned it to variable xyz
    Dim myDate As Date
    myDate = DateSerial(Left(xyz, 4), Mid(xyz, 5, 2), Right(xyz, 2))

    'Now myDate is correct date
    'you can assign it to a cell value uisng = myDate
    'it will show as say 5/1/2005 if the cell format is Date "d/M/yyy"

    'Or if you must have it in "year-month-day" format you can use:
    Dim strDate As String
    strDate = Left(xyz, 4) & "-" & Mid(xyz, 5, 2) & "-" & Right(xyz, 2)

    'And assign it to cell value using = strDate

    Sharad

    "shital shah" <[email protected]> wrote in message
    news:[email protected]...
    > Hi to all
    >
    > I have open exported file of notepad (TXT Format) Where i have data like
    > date, item,amtin,amtout,bal.
    > where data format is DD-MM-YYYY (05-01-2005)
    > the problem is when i conver this data from text to column, date comes in
    > number format like 20050105.
    >
    > is there any way i can put seprater(-) after 4 character and than after 2
    > charcter (like 2005-01-05 )
    > any help
    >
    > Thanks
    >
    > Shital shah
    >




  4. #4
    shital shah
    Guest

    Re: export file from txt (Notepad)

    Hello Mr. Sharad Naik

    you have replyed my question on dt. 8th Jan 05 but still can't find a
    solution i don't have more knowladge of macro so where to put lines

    Dim myDate As Date
    myDate = DateSerial(Left(xyz, 4), Mid(xyz, 5, 2), Right(xyz, 2))

    and how to work if you can help me it's a grate help to me.
    and soory to reply you in your direct E-mail ID.

    regards

    shital

    "Sharad Naik" wrote:

    > Hello Shital
    >
    > Assign the Date read from the txt file to a variable.
    > In below example I assume that you assigned it to variable name "xyz". You
    > can replace xyz with your variable.
    >
    > 'You already assigned it to variable xyz
    > Dim myDate As Date
    > myDate = DateSerial(Left(xyz, 4), Mid(xyz, 5, 2), Right(xyz, 2))
    >
    > 'Now myDate is correct date
    > 'you can assign it to a cell value uisng = myDate
    > 'it will show as say 5/1/2005 if the cell format is Date "d/M/yyy"
    >
    > 'Or if you must have it in "year-month-day" format you can use:
    > Dim strDate As String
    > strDate = Left(xyz, 4) & "-" & Mid(xyz, 5, 2) & "-" & Right(xyz, 2)
    >
    > 'And assign it to cell value using = strDate
    >
    > Sharad
    >
    > "shital shah" <[email protected]> wrote in message
    > news:[email protected]...
    > > Hi to all
    > >
    > > I have open exported file of notepad (TXT Format) Where i have data like
    > > date, item,amtin,amtout,bal.
    > > where data format is DD-MM-YYYY (05-01-2005)
    > > the problem is when i conver this data from text to column, date comes in
    > > number format like 20050105.
    > >
    > > is there any way i can put seprater(-) after 4 character and than after 2
    > > charcter (like 2005-01-05 )
    > > any help
    > >
    > > Thanks
    > >
    > > Shital shah
    > >

    >
    >
    >


+ 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