+ Reply to Thread
Results 1 to 28 of 28

Matched column in a new sheet

  1. #1
    Registered User
    Join Date
    11-08-2011
    Location
    KSA
    MS-Off Ver
    Excel 2007
    Posts
    93

    Matched column in a new sheet

    Here's the scenario that I want to achieve:

    1. Match File A column "A" (MRN) with File B column "A" (MRN)
    2. Only similar matches in each will be reflected in a new sheet with the following columns
    - MRN
    - Day of stay (file A)
    - Worktype
    - Doctor Name
    - Date D. Created
    - Date D. Completed

    Basically I need a shorter way to work on these 2 files as comparing them manually takes ages to finish. I need at least to automate the process. Any help is highly appreciated.

    I attached the 2 xls files for reference.
    Last edited by iamreese; 11-13-2011 at 10:52 PM. Reason: removed attachments

  2. #2
    Registered User
    Join Date
    11-08-2011
    Location
    KSA
    MS-Off Ver
    Excel 2007
    Posts
    93

    Re: Matched column in a new sheet

    any idea guys?

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Matched column in a new sheet

    Hello iamresse,

    I have both workbooks open. I see most of the column headings expect MRN, and WorkType. Which sheets are these on and which columns do they refer to?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Registered User
    Join Date
    11-08-2011
    Location
    KSA
    MS-Off Ver
    Excel 2007
    Posts
    93

    Re: Matched column in a new sheet

    opps sorry about that. I am reattaching my files...
    Last edited by iamreese; 11-14-2011 at 12:48 PM.

  5. #5
    Registered User
    Join Date
    11-08-2011
    Location
    KSA
    MS-Off Ver
    Excel 2007
    Posts
    93

    Re: Matched column in a new sheet

    or another option will be the new workbook will still have all the column A (File A) along with the columns B, C, D, E (file B). So, the new workbook will look like this:


    MRN Day of Stay Worktype Doctor Name Date D. Created Date T. Completed

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Matched column in a new sheet

    Hello iamreese,

    Thanks for posting the updated files. That makes it clear now.

    Do you need this data sorted?
    Can the combined data be saved in one of the workbooks which is already open?

  7. #7
    Registered User
    Join Date
    11-08-2011
    Location
    KSA
    MS-Off Ver
    Excel 2007
    Posts
    93

    Re: Matched column in a new sheet

    No, it does not need to be sorted out.

    Yes, it can be combined to the existing workbook.

  8. #8
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Matched column in a new sheet

    Hello iamreese,

    The new worksheet would like sheet 3 in workbook "B" with an extra column for the day of stay?

  9. #9
    Registered User
    Join Date
    11-08-2011
    Location
    KSA
    MS-Off Ver
    Excel 2007
    Posts
    93

    Re: Matched column in a new sheet

    Hi Leith,

    Yes, the new worksheet will have a combined 6 columns.

  10. #10
    Registered User
    Join Date
    11-08-2011
    Location
    KSA
    MS-Off Ver
    Excel 2007
    Posts
    93

    Re: Matched column in a new sheet

    I forgot to mention that File A is my primary file so all the matched MRN in file B should merged to A.

  11. #11
    Registered User
    Join Date
    11-08-2011
    Location
    KSA
    MS-Off Ver
    Excel 2007
    Posts
    93

    Re: Matched column in a new sheet

    bumping..just in need of expert's help

  12. #12
    Registered User
    Join Date
    11-08-2011
    Location
    KSA
    MS-Off Ver
    Excel 2007
    Posts
    93

    Re: Matched column in a new sheet

    I updated my file. I need to match Column A with Column D. If a match is found, it will put the put the result in same row including columns E to J.

    For example, A3 is matched with D792. The result should be like this:

    432040571 30/09/2011 01/10/2011 Discharge Summary 1102011 Al Hossni Yahya Mohammad 01/10/2011 18:25 02/10/2011 10:04
    Last edited by iamreese; 11-14-2011 at 12:47 PM.

  13. #13
    Registered User
    Join Date
    11-08-2011
    Location
    KSA
    MS-Off Ver
    Excel 2007
    Posts
    93

    Re: How to match and copy similar entries

    Any takers anyone? badly need help on this..

    I simplified my sample data
    Attached Files Attached Files
    Last edited by iamreese; 11-14-2011 at 12:49 PM. Reason: updated the sample file

  14. #14
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Matched column in a new sheet

    Hello iamreese,

    I would have had this done last night. However, my computer decided to go on strike and show me the Blue Screen of Death while working on your project. Most of the work was already saved.

    Someone was able to look at your newest attachment. Unfortunately, I can not. I will need to contact Roy (the system admin) to see what is wrong. To double check this not on my end, see if you can download the Discharges workbook.

  15. #15
    Registered User
    Join Date
    11-08-2011
    Location
    KSA
    MS-Off Ver
    Excel 2007
    Posts
    93

    Re: Matched column in a new sheet

    Hi Leith,

    Appreciate the time you spent on this project of mine and sorry to hear about your PC. I removed my previous attachments and replaced with the a simplified one test.xml. Maybe that's the reason why you cant download it because it is no longer available.

  16. #16
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Matched column in a new sheet

    Hello iamreese,

    Lol, mystery solved! Looks my ISP is a little slow to update this morning. I do have a few questions about the worksheets.

    Are these worksheet names the same as in the original file?
    What do you want to name "Sheet3"?
    Are all the headers in row 1?

  17. #17
    Registered User
    Join Date
    11-08-2011
    Location
    KSA
    MS-Off Ver
    Excel 2007
    Posts
    93

    Re: Matched column in a new sheet

    Are you referring to the test.xml?

    I actually renamed the worksheets. Worksheet 3 is no longer needed. Instead, it will merged to worksheet 1 (Discharge) whatever matches found in worksheet 2 (Dictation). The rows to be copied to worksheet 1 should include columns B to E.

    I think this is a much simplified sample compared to my previous files but still I cant figure it out LOL.

    Yes, all headers are in row 1.

  18. #18
    Registered User
    Join Date
    11-08-2011
    Location
    KSA
    MS-Off Ver
    Excel 2007
    Posts
    93

    Re: Matched column in a new sheet

    can you see what went wrong with the formula I used:

    https://docs.google.com/spreadsheet/...lhNeXZuWllNekE

    Note: I cant attach the file as it exceeded 1 MB.

  19. #19
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Matched column in a new sheet

    Hello iamreese,

    I have a situation that requires some clarification. Patient ID 432046622 occurs 6 times on the discharge sheet but only once on the Dictation sheet. Should I apply the Dictation data to all 6 items on the Discharge sheet?
    Please Login or Register  to view this content.

  20. #20
    Registered User
    Join Date
    11-08-2011
    Location
    KSA
    MS-Off Ver
    Excel 2007
    Posts
    93

    Re: Matched column in a new sheet

    Hi leith, yes you can apply it to all matches..hmm I will see those items 2-5 coz the dates are definitely wrong..thanks as always..

  21. #21
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Matched column in a new sheet

    Hello iamreese,

    This macro looks to me to be correct. However, after many hours of checking and rechecking, it is good for someone else to take a fresh look. Here is the macro that has been added to the attached workbook.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  22. #22
    Registered User
    Join Date
    11-08-2011
    Location
    KSA
    MS-Off Ver
    Excel 2007
    Posts
    93

    Re: Matched column in a new sheet

    I will try this one now. Will the macro still work if I expand my data in both sheets?

  23. #23
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Matched column in a new sheet

    Hello iamreese,

    If you expand your rows on both sheets then no changes will need to be made to macro. If you change the columns then I will need to make adjustments the macro.

  24. #24
    Registered User
    Join Date
    11-08-2011
    Location
    KSA
    MS-Off Ver
    Excel 2007
    Posts
    93

    Re: Matched column in a new sheet

    okay, i am running the macro now and still calculating. Initial results looks good but i am still waiting for it to finish running. It really takes a while to calculate?

  25. #25
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Matched column in a new sheet

    Hello iamreese,

    On the workbook I posted with the macro, it ran in less than second on my computer. Do you have forumlas in the workbook that the macro is running in? If so, formula claculation should be suspended until the macro has finished running.

  26. #26
    Registered User
    Join Date
    11-08-2011
    Location
    KSA
    MS-Off Ver
    Excel 2007
    Posts
    93

    Re: Matched column in a new sheet

    It's working great Leith!

    The only scenario that I found is when a patient ID in Discharge contains 2 or more matches in Dictation. The macro just matched and copy only 1 row.

    For example:

    432049194 found 2 matches in dictation sheet, discharge summary and operative report.

    Is there a workaround on this that multiple matches will go to rows I, J and so on?

  27. #27
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Matched column in a new sheet

    Hello iamreese,

    If there will multiple entries on Dictation for a patient then I will need to make some changes to the macro.

    How will the multiple Dictation entries be applied to the Discharge entries?

  28. #28
    Registered User
    Join Date
    11-08-2011
    Location
    KSA
    MS-Off Ver
    Excel 2007
    Posts
    93

    Re: Matched column in a new sheet

    The column name will look like this:


    Patient ID Admission Date Discharge Date Day of Stay WORKTYPE DICTATOR NAME Date D. Created Date T. Completed WORKTYPE DICTATOR NAME Date D. Created Date T. Completed

    Duplicate will be copied in columns I, J, K, L in Discharge worksheet (WORKTYPE DICTATOR NAM Date D. Created Date T. Completed)


    If more than 2 matches were found then it will be in M, N, O, P columns

    I attached the test file with the macro and columns for additional matches.
    Last edited by iamreese; 11-18-2011 at 01:27 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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