+ Reply to Thread
Results 1 to 7 of 7

Joining data from two worksheets into one or displaying data from one in the other

  1. #1
    Registered User
    Join Date
    05-04-2012
    Location
    Toowoomba Australia
    MS-Off Ver
    Excel 2003 & Excel Mac 2011
    Posts
    4

    Joining data from two worksheets into one or displaying data from one in the other

    I have Excel Mac 2011 and also Excel Win 2003. I need to produce a worksheet for others to use in Win 2003. My problem is:

    I have workbook with two worksheets:
    Worksheet 1 has id numbers corresponding to people names and other details. Each person and id is listed only once as the id identifies that person.

    Worksheet 2 has more information about these people but doesn't have their names, just their id numbers. In some cases, however, there are multiple records for the same person.

    I need to combine the two worksheets so that it shows all the events for each person on the one sheet. I don't want to have to go through and make new lines for multiple entries and cut and paste as I have about 13000 id's.

    Is there a way to easily combine the two so that all entries for each person are listed together OR alternatively that if you click on the id or name on the first worksheet it displays just those entries that match the id on the second worksheet?

    I could do this by transferring the data to MS Access and using a subform but most of the intended users don't have MS Access so I really need to stick with Excel. That's also why I need it to work in Excel 2003 - regardless of what I build it in.

    I'd be grateful for any help.

    thanks,

    roger

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    12,970

    Re: Joining data from two worksheets into one or displaying data from one in the other

    ... Is there a way to easily combine the two so that all entries for each person are listed together OR alternatively that if you click on the id or name on the first worksheet it displays just those entries that match the id on the second worksheet?
    The answer is: "Yes, use VBA"; but I doubt if that will help! If you want help, you have to help us to help you: post a workbook with enough sample data to see the range of different records you are dealing with.
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    05-04-2012
    Location
    Toowoomba Australia
    MS-Off Ver
    Excel 2003 & Excel Mac 2011
    Posts
    4

    Re: Joining data from two worksheets into one or displaying data from one in the other

    Thank you for the tip - I though my explanation had been clear enough - obviously a newby mistake. I've attached 30 records from each of the two worksheets though, as I said before, there are some thousands of records however all basically contain the same information as in the sample it's just that some patients have 8 or 9 episodes of care and some only one.

    roger
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    12,970

    Re: Joining data from two worksheets into one or displaying data from one in the other

    I'm [not] quite clear with what you want, but have a look. The cursor must be in any column on sheet "patients" then click the "view summary" button.
    Attached Files Attached Files
    Last edited by protonLeah; 05-06-2012 at 03:14 PM.

  5. #5
    Registered User
    Join Date
    05-04-2012
    Location
    Toowoomba Australia
    MS-Off Ver
    Excel 2003 & Excel Mac 2011
    Posts
    4

    Smile Re: Joining data from two worksheets into one or displaying data from on?e in the other

    Dear Ben,

    Thank you so much - you're a whizz - don't know what you did but this is exactly what I need. Can you explain how you make this happen either on the thread, or if permissible, directly to me at roger@hawcroft.net. I don't want to break any thread rules.

    Thanks again

    This will save me hours of work and provide the users with exactly what they need.

    My sincere thanks for your time, patience and expertise.

    roger

  6. #6
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    12,970

    Re: Joining data from two worksheets into one or displaying data from one in the other

    The button "View Summary" on the Patients worksheet calls a macro "Button1_Click()"
    Please Login or Register  to view this content.
    This macro checks to see if the active cell in within the data table on Patients sheet. If so, it retrieves the patient id from column A and uses that id number toloop through the records on the "Episodes of Care" sheet. Each time the id number is found, the macro adds the line to the listbox. When all the records have been tested, it displays the form with a "Close" button.

    To see the form and the code, right click either of the sheet tabs and select View Code.
    In the VBAProject Window, click PatientSummary under the Forms folder.
    Click Module1 to view or edit the button1_click macro.

  7. #7
    Registered User
    Join Date
    05-04-2012
    Location
    Toowoomba Australia
    MS-Off Ver
    Excel 2003 & Excel Mac 2011
    Posts
    4

    Re: Joining data from two worksheets into one or displaying data from one in the other

    Thanks again, Ben - I've never done any coding so this is all new to me but your explanation is very clear and inspires me to do some learning in the area. How would I go about putting headers for 'Admission Date', 'Discharge Date', 'Condition' on that form, for instance?

    roger

    Quote Originally Posted by protonLeah View Post
    The button "View Summary" on the Patients worksheet calls a macro "Button1_Click()"
    Please Login or Register  to view this content.
    This macro checks to see if the active cell in within the data table on Patients sheet. If so, it retrieves the patient id from column A and uses that id number toloop through the records on the "Episodes of Care" sheet. Each time the id number is found, the macro adds the line to the listbox. When all the records have been tested, it displays the form with a "Close" button.

    To see the form and the code, right click either of the sheet tabs and select View Code.
    In the VBAProject Window, click PatientSummary under the Forms folder.
    Click Module1 to view or edit the button1_click macro.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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