+ Reply to Thread
Results 1 to 5 of 5

Two Excel Sheets - Merging Selective Info

  1. #1
    Registered User
    Join Date
    07-18-2021
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    4

    Two Excel Sheets - Merging Selective Info

    I have an xls file comprising 2 excel sheets. Each sheet has a common column/field with the heading PID.

    Both sheets have been exported from a medical patients record system. One sheet is a complete demographics of all patients in the database and comprises of more than 200K records (let's call this sheet Demographics), while the other sheet comprises of those patients who have visited the clinic in the past 5 yrs and has about 70K records (let's call this sheet Visits). Many records in the Visits sheet comprise of patients visiting the clinic more than once. So many of the PID's (Patient Identification) will be repetitive. While the Demographics sheet lists a PID only once and each PID is linked to only one person. For example, there are some patients who have visited the clinic 7 times in the past 5yrs, so the visits sheet will show 7 records for the same PID, while the demographics sheet will only show one record for this PID.

    Since the Visits sheet does not show names and contact details of the patient associated with the unique PID, I need to somehow know by name and contact details (eg tel, email) who are the people who have been visiting the clinic in the past 5yrs.
    So In Visits sheet I want to add the columns ie Telephone, email and name, next to the appropriate PID.

    So I made 2 separate files: Demographics.xlsx and Visits.xlsx

    I cleaned up all the unnecessary columns in Demographics.xlsx and am now left with the following column headings:

    pid fname lname phone_home phone_biz phone_contact phone_cell email
    And then I have the Visits.xlsx file with the following columns:
    pid fname lname email

    Now I went into the Visits.xlsx file which under the pid column has 79818 records (the other columns are empty) and now in the fname I did:
    pid fname lname email
    93969 =VLOOKUP(pid,['Demographics']Demographics!$A$2:$H$2,8,FALSE)
    and here (in the Visits.xlsx file) I would expect the fname for PID 93969 to be automatically filled with Salim which is the fname record in the Demographics.xls file for PID 93969 but instead, I'm presented with #NAME? error, "The formula contains unrecognized text"

    So I'm not sure how I can bring in the records from the Demographics.xlsx file and get the appropriate record next to it's respective PID.

    Would really appreciate some help on this, pls.

  2. #2
    Valued Forum Contributor
    Join Date
    04-24-2020
    Location
    Woodbridge, VA
    MS-Off Ver
    2016
    Posts
    434

    Re: Two Excel Sheets - Merging Selective Info

    Hi - can you post a small sample of your files?

  3. #3
    Registered User
    Join Date
    07-18-2021
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    4

    Re: Two Excel Sheets - Merging Selective Info

    As for the Demographics sheet, I've replaced actual data (first name, last name, contact numbers and emails) to dummy data and have kept only the first 3 lines available. The PID column remains unchanged in both sheets.

    I managed to directly attach the Visits.xlsx to this message, but the Demographics.xlsx file exceeded the size limit and can be found here: bit[DOT]ly/3BfHjiR
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor
    Join Date
    04-24-2020
    Location
    Woodbridge, VA
    MS-Off Ver
    2016
    Posts
    434

    Re: Two Excel Sheets - Merging Selective Info

    So I could not get your Demographics file so I added a tab in your file and made up a few lines. See attached sheet.

    One thing I noticed in your formula you had =VLOOKUP(PID but I did not see PID in the Name Manager(in Formula tab). So you have to highlight Column A in Visits tab, click on Formula tab, under Defined Tabs section click on Define Name and then click OK. Otherwise it has nothing to reference that PID to. You would just have to use =VLOOKUP(A2 for example if you did not do all that before.

    Also the last number in the formula, in your case 8 refers to the columns that you have to count where you want the info to come from. In that case that is the email column, not the fname.

    Hope all this makes sense --- take a look at what I have done and let me know if I can explain anything better.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    07-18-2021
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    4

    Re: Two Excel Sheets - Merging Selective Info

    Worked beautifully, Thanks.

+ 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. Excel sheets merging
    By alishoki in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-02-2019, 08:49 AM
  2. Need to combine excel sheets but with selective columns
    By daga.sachin120887 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-15-2017, 03:27 AM
  3. [SOLVED] merging info from 2 sheets within the same workbook
    By mglinski in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-02-2014, 11:33 AM
  4. Macro to Print Multiple (Selective) Excel sheets to One PDF
    By volfan212 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-20-2013, 03:42 PM
  5. Merging Excel with Excel - more info
    By Janet in forum Excel General
    Replies: 5
    Last Post: 04-04-2006, 06:55 PM
  6. Need help merging selective data
    By JM in forum Excel General
    Replies: 1
    Last Post: 01-05-2006, 02:25 PM
  7. Need Help Merging Info with Duplicate data in Excel 2000
    By kketelsen in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 03-30-2005, 11:44 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