+ Reply to Thread
Results 1 to 4 of 4

Changing data from one format into another

  1. #1
    Registered User
    Join Date
    02-09-2010
    Location
    Dayton
    MS-Off Ver
    Excel 2007
    Posts
    23

    Changing data from one format into another

    I have a data set in excel which is the following format which I would like to convert into a text file with a different format.

    The excel sheet format is as follows:

    V C 1 2 3
    1 23 0.06 0.04 0.03
    1 12 0.09 0.06 0.03
    2 5 0.11 0.07 0.05
    2 11 0.12 0.08 0.04

    The text file should have the above data in the following format with brackets and comma:
    (V,C,1)[value]

    For example:
    (1,23,1)[0.06]
    (1,23,2)[0.04]
    (1,23,3)[0.03]
    (1,12,1)[0.09]
    (1,12,2)[0.06]
    (1,12,3)[0.03]
    (2,5,1)[0.11]
    .
    .
    .
    .
    .and so on.
    I have attached the sample sheets. Kindly help me out with this data transformation.

    Thanking you,
    Ramanan
    Attached Files Attached Files
    Last edited by ramanan256; 02-11-2010 at 08:17 PM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Changing data from one format into another

    Hello Ramnan256,

    The macro below converts the data into the format you need.The text file is saved to the same folder as the workbook and is named "VC Data.txt". You can the file path and file name to what you will be using. A button has been added to "Sheet1" labeled "Save". This will run the macro when clicked.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    02-09-2010
    Location
    Dayton
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Changing data from one format into another

    The format that the code you sent does not include the third number as I had mentioned in my text file earlier. It should have been (1,1,1) in the text file. The third number is that of the number above the value within [ ]. If you would look again into my text file you could understand what I mean.

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Changing data from one format into another

    Hello ramanan256,

    Here is corrected macro. It has been added to the attached workbook.
    Please Login or Register  to view this content.
    Attached Files Attached Files

+ 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