+ Reply to Thread
Results 1 to 17 of 17

Merging Data from two separate sheet based on unique ID

  1. #1
    Registered User
    Join Date
    09-13-2022
    Location
    Boston, USA
    MS-Off Ver
    2021
    Posts
    8

    Merging Data from two separate sheet based on unique ID

    Hello everyone,


    I have a question that I think this is the correct place for. I have two sets of data on two separate sheets. The data is connected by a unique study ID. There is at least one of each study ID in each set of data, and there are instances where there are multiple of each study ID in each data sets (e.x. 10 1003s on sheet 1, 1 1003 on sheet2). There should always be at least as many pieces of data on sheet 1 as there are on sheet 2 (e.x. there will never be 2 1005s on sheet 1 and 10 1005s on sheet 2). I want to combine the data from each sheet into a single row (the data with 1001 from sheet 1 and sheet 2 together on a single line on sheet 3). In instances where there are unequal number of IDs on sheet 1 and 2, I want to consolidate data based on having the closest date and time on ADMIT_DTTM on sheet 1 and teen_demographics_timestamp on sheet 2.

    Does this make sense? If it makes sense, is it even possible?

    If anyone has insight I would greatly appreciate it, as it will save me about many hours of manually consolidating

    Example Workbook.xlsx

    Example Workbook 2.xlsx
    Last edited by pcsojka; 09-27-2022 at 05:42 PM.

  2. #2
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Merging Data from two separate sheet based on unique ID

    is that what you want?

    with Power Query

  3. #3
    Registered User
    Join Date
    09-13-2022
    Location
    Boston, USA
    MS-Off Ver
    2021
    Posts
    8

    Re: Merging Data from two separate sheet based on unique ID

    I think so! That is beautiful.

  4. #4
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Merging Data from two separate sheet based on unique ID

    I am glad I could help
    so hit Add Reputation then mark this thread as Solved

    have a nice day

  5. #5
    Registered User
    Join Date
    09-13-2022
    Location
    Boston, USA
    MS-Off Ver
    2021
    Posts
    8

    Re: Merging Data from two separate sheet based on unique ID

    Sorry I am a little confused. How can I take that power query and apply it to my actual data set?

  6. #6
    Registered User
    Join Date
    09-13-2022
    Location
    Boston, USA
    MS-Off Ver
    2021
    Posts
    8

    Re: Merging Data from two separate sheet based on unique ID

    Also because I am new to this, how to do I mark a thread as solved?

  7. #7
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Merging Data from two separate sheet based on unique ID

    Data tab
    Show Queries
    on the right side double click on Merge query
    in new Power Query window choose Home tab then Advanced Editor

    or just add more data to your source tables then right click on green table and select Refresh

    from the top of your thread Thread Tools and select Solved (maybe because I have never done it before )
    Last edited by sandy666; 09-23-2022 at 12:18 PM.

  8. #8
    Registered User
    Join Date
    09-13-2022
    Location
    Boston, USA
    MS-Off Ver
    2021
    Posts
    8

    Re: Merging Data from two separate sheet based on unique ID

    I am still struggling with this. I think an error was that in my actual data set the unique piece of data that connects the two worksheets is a medical record number (confidential). When I try to add more data It does not update appropriately and the information from the second sheet does not merge. I am worried this may be above my technical prowess.

  9. #9
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Merging Data from two separate sheet based on unique ID

    probably because your "actual data" structure is different from this what showed in example
    I don't care about your data but structure must be the same as original

  10. #10
    Registered User
    Join Date
    09-13-2022
    Location
    Boston, USA
    MS-Off Ver
    2021
    Posts
    8

    Re: Merging Data from two separate sheet based on unique ID

    Okay I think I made sure the actual data structure is the same as the example and added it to the original post. Thank you so much for your help.

  11. #11
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Merging Data from two separate sheet based on unique ID

    My pleasure

  12. #12
    Registered User
    Join Date
    09-13-2022
    Location
    Boston, USA
    MS-Off Ver
    2021
    Posts
    8

    Re: Merging Data from two separate sheet based on unique ID

    Do you think you could reevaluate with the new data set to make sure the data structure is appropriate?

  13. #13
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Merging Data from two separate sheet based on unique ID

    just post new example and we will see

  14. #14
    Registered User
    Join Date
    09-13-2022
    Location
    Boston, USA
    MS-Off Ver
    2021
    Posts
    8

    Re: Merging Data from two separate sheet based on unique ID

    I added a new example worksheet to the initial message. I cannot figure out how to add another link to the reply messages.

  15. #15
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Merging Data from two separate sheet based on unique ID

    don't change example in the first post because all post after doesn't make sense
    new example - new post

  16. #16
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Merging Data from two separate sheet based on unique ID

    btw. don't use blank rows in source tables , it also doesn't make sense




    Click the Add Reputation at the foot of any of the posts of members who helped you
    Attached Files Attached Files
    Last edited by sandy666; 09-28-2022 at 12:23 PM.

  17. #17
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Merging Data from two separate sheet based on unique ID

    or maybe you like this one

+ 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. separate sheet data based on two columns
    By redahussien in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 07-07-2021, 02:56 PM
  2. [SOLVED] Combining 2 Sheets Merging Based on Unique Identifier
    By kirrash in forum Excel General
    Replies: 0
    Last Post: 10-13-2020, 11:49 AM
  3. Replies: 1
    Last Post: 01-29-2015, 04:08 PM
  4. Extracting data from a row on one sheet into another sheet based on a unique cell
    By roshanvarghese in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 01-23-2013, 03:49 AM
  5. Merging Data from Separate Tables
    By william. in forum Access Tables & Databases
    Replies: 2
    Last Post: 11-02-2012, 05:07 PM
  6. Merging Data from Separate Tables
    By william. in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-31-2012, 01:34 PM
  7. Merging Data from 2 Separate Spreadsheets
    By MrBlund in forum Excel General
    Replies: 1
    Last Post: 06-15-2012, 04: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