+ Reply to Thread
Results 1 to 7 of 7

Flattening A File - Awkward Data Output

  1. #1
    Registered User
    Join Date
    04-15-2013
    Location
    NYC
    MS-Off Ver
    Excel 2007
    Posts
    84

    Flattening A File - Awkward Data Output

    Hello,

    I have a file that a system spits out that is somewhat useless (sample attached - first doc out of 3k). It merges the first few columns that are common to the rows and then places data into rows within a single cell. How do I go about flattening this file? I need a value in each column without the odd formatting.

    I would appreciate any help.

    Thank you,
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    04-15-2013
    Location
    NYC
    MS-Off Ver
    Excel 2007
    Posts
    84

    Re: Flattening A File - Awkward Data Output

    Did some more research:

    Basically this is a txt to row problem which is generally solved by transposing/txt to column combinations. The problem I am facing is that when there is more than one (3k in this case) of rows that need to be expanded, that work around does not work.

    Thank you,

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Flattening A File - Awkward Data Output

    Hi,

    Try the following macro. It assumes a 2nd sheet 2 with a VBA sheet code name 'Sheet2'. See file attached.
    If it starts to take a long time given a much larger data set then post back and I'll modify the code so that the data is first read into a VB array and processes entirely within the VBE and written back to the sheet at the end.


    Please Login or Register  to view this content.
    Attached Files Attached Files
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Registered User
    Join Date
    04-15-2013
    Location
    NYC
    MS-Off Ver
    Excel 2007
    Posts
    84

    Re: Flattening A File - Awkward Data Output

    This is very close, but doesn't quite run the whole thing. I attached a larger sample in the doc you posted.
    Attached Files Attached Files

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Flattening A File - Awkward Data Output

    Hi,

    See slight Mod attached
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    04-15-2013
    Location
    NYC
    MS-Off Ver
    Excel 2007
    Posts
    84

    Re: Flattening A File - Awkward Data Output

    This is awesome. Looking forward to reverse engineering and learning something.

    Thank you,

  7. #7
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Flattening A File - Awkward Data Output

    Glad to have helped and thanks for the rep.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Flattening export file
    By kateyesofblue in forum Excel General
    Replies: 1
    Last Post: 05-30-2012, 06:37 PM
  2. Flattening Data
    By Davywat in forum Excel General
    Replies: 4
    Last Post: 04-25-2012, 03:37 PM
  3. Replies: 1
    Last Post: 03-13-2012, 09:45 AM
  4. Replies: 2
    Last Post: 09-15-2009, 04:25 PM
  5. [SOLVED] Open CSV file, format data and write output to a text file.
    By BristolBloos in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-18-2005, 11:05 AM

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