+ Reply to Thread
Results 1 to 6 of 6

Extracting data from misaligned columns

  1. #1
    Registered User
    Join Date
    10-02-2003
    Location
    East Midlands, UK
    MS-Off Ver
    MS Office Professional Plus 2016
    Posts
    40

    Extracting data from misaligned columns

    I have a load of running results data scrapped from a public website* that I need to further transform.

    Find a running club via the link above, (enter two letters and it'll show you any valid clubs starting with those letters), choose the Overall results for either men or women, and that's what I'm using (I'm using the overall results for both men and women).

    I'm copying the whole of the results from the first line to the last, but excluding any other page data, then pasting into A1 on a worksheet.

    Results from a track-based event are listed first, then road races. For each event, there's a new set of headers. My club runs mainly road, but with a few track-based events, so I need data from them all.

    You will see that track-based results have an additional column entitled "Year" that road-based do not, meaning the columns are misaligned.

    I want to pull data from this dump into another table. How do I solve the issue of the misaligned data? I know how to solve it manually but there must be a way to do this more efficiently.

    Using MS Office Pro Plus 2016.

    TestData.xlsx

  2. #2
    Registered User
    Join Date
    10-02-2003
    Location
    East Midlands, UK
    MS-Off Ver
    MS Office Professional Plus 2016
    Posts
    40

    Re: Extracting data from misaligned columns

    I fear in trying to simplify for the purposes of asking my question, I've omitted some key points.

    My additional table would just be using cell refs to pull in the data in the respective columns.

    I was planning on using something like =if[NAME]*<>"",[CellRef] so that I only picked up the from lines that were populated with results. I'd suppress any lines that were blank. I've additionally pulled the race title onto the same line as the rest of the data so that can be pulled across.

    So, I want to write one line's worth of cell references that I can use to pull the right data into the right columns, then copy those down the entire table. It's writing those cell references to deal with the fact that some data is offset that I can't figure out.

    * i.e. using the Name column as a check of whether the row is populated with a result or not.
    Attached Files Attached Files
    Last edited by BaldySlaphead; 10-11-2022 at 08:16 AM. Reason: Adding additional example

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Extracting data from misaligned columns

    Your intermediate table seemed to work well, so I adapted it a bit.... and stuck on a few extra bits to identify the important add-ons. Take a look. Lots of formulae in the shaded areas. Happy to explain any of them.

    Take a look...
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  4. #4
    Registered User
    Join Date
    10-02-2003
    Location
    East Midlands, UK
    MS-Off Ver
    MS Office Professional Plus 2016
    Posts
    40

    Re: Extracting data from misaligned columns

    Wow - great job, Glenn! I'm going to have to spend a bit of time to understand everything you've done here, but it absolutely does what I want it to do!

    Thanks so much!

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Extracting data from misaligned columns

    The one that does the hard work is in T2. To improve understanability... change it to (i moved it at one stage and forgot to change the bit in red):

    =IFERROR(AGGREGATE(15,6,ROW($G$2:$G$20)/(($G$2:$G$20<>"Name")*($G$2:$G$20<>"")),ROWS(T$2:T2)),"")

    How does it work?

    =IFERROR(AGGREGATE(15,6,ROW($G$2:$G$20)/(($G$2:$G$20<>"Name")*($G$2:$G$20<>"")),ROWS(T$2:T2)),"")

    Basically it is looking in G2:G20 for rows that match TWO criteria:

    RED - not = "Name" and

    Cyan - not blank

    It then returns the row numbers, that match those criteria... T$2:T2 being a counter... and AGGREGATE's subfunction 15 telling it to retun them in ascending order.

    The rest is reasonably straightforward.

  6. #6
    Registered User
    Join Date
    10-02-2003
    Location
    East Midlands, UK
    MS-Off Ver
    MS Office Professional Plus 2016
    Posts
    40

    Re: Extracting data from misaligned columns

    Thanks - that's really useful!

+ 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. [SOLVED] Misaligned Data After Table Sort
    By SweetBaboo in forum Excel General
    Replies: 5
    Last Post: 09-17-2021, 08:50 PM
  2. Replies: 0
    Last Post: 08-03-2011, 08:40 AM
  3. Misaligned manual data on refresh
    By Emma1234 in forum Excel General
    Replies: 0
    Last Post: 03-28-2011, 06:17 PM
  4. Macro to fix Misaligned Data from .csv File
    By Gos-C in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-20-2006, 08:01 AM
  5. Replies: 0
    Last Post: 08-18-2005, 12:05 PM
  6. columns misaligned after save
    By MarkJames240 in forum Excel General
    Replies: 2
    Last Post: 05-02-2005, 08:06 PM
  7. [SOLVED] Extracting data from other columns
    By Polar in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-10-2005, 09:06 AM

Tags for this Thread

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