+ Reply to Thread
Results 1 to 14 of 14

Extract Data from rows into columns

  1. #1
    Registered User
    Join Date
    10-15-2009
    Location
    Washington, DC USA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Extract Data from rows into columns

    Hi,

    I'm using Excel 2007 and I need to extract values from rows from a data dump into columns. Here is sample data (this is dummy data, but the format is the same):

    > Log for Account 55555 Institution Number 55
    >
    > ----------- text text text text text text
    > Certificate 5555555555 line number 555 via USD 555,555.00-
    > text text text: date number percent 0 percent 0
    > number text text text text text text
    > text text text text text date; text text text date
    > Text text text text percent text text
    text text text number text. Text text text text text.
    Text text text text text text percent
    Text text text USD 5,555.00 text text text text text text
    > Text text text text text text text
    >
    > ----------- text text text text text text
    > Certificate 5555555562 line number 555 via USD 555,562.00-
    > text text text: date number percent 0 percent 0
    > number text text text text text text
    > text text text text text date; text text text date
    > Text text text text percent text text
    text text text number text. Text text text text text.
    Text text text text text text percent
    Text text text USD 5,555.62 text text text text text text
    > Text text text text text text text
    >
    > Log for Account 44444 Institution Number 44

    ....

    I want to extract the number values (in bold) into a sheet in columns that will look like this:

    Account Certificate Amount Int. Amount
    55555 5555555555 555,555.00 5,555.62
    55555 5555555562 555,562.00 5,555.62
    44444 ....

    The data dump continues and and each Account can have any number of Certificates in it. Each line of dummy data represents a new row. What's the best way to go about extracting this data?

    Thanks

  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,259

    Re: Extract Data from rows into colums

    Hello purvi214,

    Welcome to the Forum!

    Will the numbers you are interested in be preceded by the words: Account, Certificate and USD?
    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
    10-15-2009
    Location
    Washington, DC USA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Extract Data from rows into colums

    Hi Leith,

    Thanks! No, Account, Certificate... etc will be the name of the columns, I just want the numbers in the columns. Thanks for your help!

  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,259

    Re: Extract Data from rows into colums

    Hello purvi214,

    The data sample you show is in rows, not columns. Without some reference either before or after the number as it appears in the file, there is no way to know if the correct value has been extracted.

  5. #5
    Registered User
    Join Date
    10-15-2009
    Location
    Washington, DC USA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Extract Data from rows into colums

    Sorry Leith,

    I misunderstood the question. Yes, the words will precede the values. Sorry for the confusion. Thanks!

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

    Re: Extract Data from rows into colums

    Hello puri214,

    I have most of this figured out, but I have a couple of questions I need answered.

    Is the data posted identical to actual data?

    Has the data been transferred to a worksheet already and each line is occupying one row?

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

    Re: Extract Data from rows into colums

    Hello purvi214,

    I have it working based on your the example you posted. This assumes the data is already in rows on the worksheet. It then separates the data into columns like you want. You will probably need to change the worksheet names to match what are in your workbook. I have marked them in red. This macro has been added to the attached workbook along with a button to run the macro.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    10-15-2009
    Location
    Washington, DC USA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Extract Data from rows into colums

    Hi Leith,

    Thank you so much!! This worked great. Except, it's only reading the interest amount and not the initial amount. The initial amount line has six spaces in between USD and the amount and looks like this:
    > Certificate 555555555 text text number text USD 555,555.55-

    (I don't think the post shows the six spaces, so it was missed when I first posted it)
    So for the initial amount there is six spaces in between USD and the dollar amount. The interest amount line does not have spaces and looks like this:
    Text text text USD 5,555.55 text text text text text text

    Thanks a lot!

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

    Re: Extract Data from rows into colums

    Hello purvi214,

    The initial amount line has six spaces in between USD and the amount and looks like this:
    Can you show me exactly where the spaces are?

  10. #10
    Registered User
    Join Date
    10-15-2009
    Location
    Washington, DC USA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Extract Data from rows into colums

    Hi Leith,

    It looks like this:

    > Certificate 555555555 text text number text USDspacespacespacespacespacespace555,555.55-

    Thanks!

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

    Re: Extract Data from rows into colums

    Hello purvi214,

    The macro has been adjusted to account for multiple spaces. The change in the code below is marked in red and has been added to the attached workbook.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    11-08-2009
    Location
    Las Vegas NV
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Extract Data from rows into columns

    Hi Lee,

    I think I have a similar problem. The answer is probably somewhere in the forum, but I looked around and I can't figure it out on my own. Basically, I copied some data off a website and now I am trying to organize it so it is usable. Here is my example.

    I would like to put the data below into usable columns. The only data I need is the hospital name (column A), location (column B), Births (column C), and Beds (column D).

    This is how the data currently appears in excel:

    Banner Desert Medical Center*— Mesa, AZ
    Hospital Type General medical and surgical ER Visits: 83,212
    Admissions/Visits: 41,542*Inpatient*/ 133,208*Outpatient Births: 7,552
    Surgeries: 8,793*Inpatient*/ 9,581*Outpatient Beds: 518
    Banner Thunderbird Medical Center*— Glendale, AZ
    Hospital Type General medical and surgical ER Visits: 65,827
    Admissions/Visits: 29,189*Inpatient*/ 256,950*Outpatient Births: 4,821
    Surgeries: 10,448*Inpatient*/ 4,660*Outpatient Beds: 376

    Thanks for any advice!

  13. #13
    Registered User
    Join Date
    11-08-2009
    Location
    Las Vegas NV
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Extract Data from rows into columns

    Might help to see the actual file (attached)....
    Attached Files Attached Files

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

    Re: Extract Data from rows into columns

    Hello bpbach,

    Welcome to the Forum!

    You should start a new thread. This post has been answered. You can provide a link back to this post in your one for reference. After you have started a new thread, I will post the answer for you.

    As a new member of the forum, please take a few minutes and read the forum rules for posting and general etiquette. To see them, click on the link below...

    Forum Rules

+ 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