+ Reply to Thread
Results 1 to 6 of 6

aligning two sets of data by row number data and both sets have missing/extra data.

  1. #1
    Registered User
    Join Date
    07-24-2023
    Location
    Omaha, Nebraska
    MS-Off Ver
    Office365
    Posts
    2

    aligning two sets of data by row number data and both sets have missing/extra data.

    I need to sort based on line number data from two separate sheets. the data has been combined on a separate sheet for sorting to ensure the integrity of the first two sheets
    Sheet1!A2:C16 is data SetA from one table. Sheet1!D2:G15 is data SetB from another table. The matching data is the addresses in columns C & E, respectfully, however the sorting is based on data from a =ROW() function call.
    I need to match the data in column D in set D2:G15 to the correct line identified in set A2:A16. Sheet 2 shows after the desired sorting. The end result is that the Phone number and Group are aligned to the correct Name and Address from date SetA. I will be sorting the results by what?s in both data sets, what?s in the SetA Only, and what?s in the SetB Only. And further sorting those three by Group number.
    Notes concerning my real work-
    - Data SetA is 17253 Rows. Data SetB is 10331 rows of usable data.
    - At row 6193 data SetB line numbers stop and the value is replaced by #N/A which go to row 17253.
    - Phone Numbers and Group columns end at row 10331in data SetB.
    - Phone numbers are sometimes filled with the string ?no data?. (The actual data is IP addresses in the format nnn.nnn.nnn.nnn so setting the field type to integer won?t work. Guessing they have to be a $tring type if designating it is needed.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,204

    Re: aligning two sets of data by row number data and both sets have missing/extra data.

    Please Login or Register  to view this content.
    results in sheet3
    Attached Files Attached Files
    Last edited by JohnTopley; 07-25-2023 at 09:23 AM.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  3. #3
    Registered User
    Join Date
    07-24-2023
    Location
    Omaha, Nebraska
    MS-Off Ver
    Office365
    Posts
    2

    Re: aligning two sets of data by row number data and both sets have missing/extra data.

    I will need to research the commands to fully grasp this, but your output is as I intended.
    What I think I understand is:
    the 'a = Sheets' assignment is assigning 'a' as the original array, defining the dimensions of the array by current data fields.
    The ReDim statement is declaring the dimensions of the output array, 'b'.
    In the For statement, 'i' is used as the row counter, starting at 2(for after headers?) through the row limit defined by the UBound command that gets the limit of the a array. j appears to be one less
    than the value in the cell defined by the value of i and the first column (which is actually just the row number). Why is there a "-1" when setting the value? This part I'm not sure at all about.
    max_j appears to be checking for the max number of columns(?), then later is used to number the rows in sheet 3.
    Don't know Application.Max (j, j_max).
    I also don't get the lf/then line. We're checking for a blank cell in column 4? There are no blanks until after the last line.

    Thanks in advance for any clarity/explanations you can provide. I'd rather understand the why with the how. The whole 'teach a man to fish' thing.
    On my project, the sorting was output on the same sheet, but it's good to see how to output to a different sheet. Also there are 17K+ rows in my first set of data and 10K+ in the second. The match-able data is 6193 rows. I tried defining the array search range to these smaller limits, but I kept getting Spill errors trying to do this with formulas. I'm guessing now it was because maybe once it hit the first blank cell and the rest shifted down, it exceeded the array range.
    Last edited by 626Stitch; 07-25-2023 at 06:13 PM. Reason: clarity.

  4. #4
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,427

    Re: aligning two sets of data by row number data and both sets have missing/extra data.

    Here is a solution with a formula:
    Please try
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by HansDouwe; 07-25-2023 at 07:24 PM.

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,204

    Re: aligning two sets of data by row number data and both sets have missing/extra data.

    Annotated code- hope this helps

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    03-09-2023
    Location
    Nevada, USA
    MS-Off Ver
    2021
    Posts
    10

    Re: aligning two sets of data by row number data and both sets have missing/extra data.

    Thanks john, that works for me

+ 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. Analyze two data sets and find missing data cells
    By sniper1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-16-2021, 05:14 PM
  2. How To Compare Two Sets Of Similar Data Sets To Find a Good Match
    By Mark123456789 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-24-2016, 01:29 AM
  3. Compiling and aligning info from four data sets with common ID in all of them
    By glaza777 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-14-2013, 10:18 PM
  4. [SOLVED] Ploting multiple data sets with non-aligning x-data
    By motivef in forum Excel General
    Replies: 3
    Last Post: 07-19-2012, 07:49 PM
  5. [SOLVED] Copy missing values to matching data sets
    By Krausskopf in forum Excel General
    Replies: 4
    Last Post: 04-13-2012, 01:55 PM
  6. Pairing two data sets, both with missing data
    By Peter Chapman in forum Excel General
    Replies: 2
    Last Post: 06-10-2008, 04:43 AM
  7. Replies: 1
    Last Post: 06-29-2006, 04:25 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