+ Reply to Thread
Results 1 to 11 of 11

Comparing 2 separate columns in 2 separate Excel sheets

  1. #1
    Registered User
    Join Date
    07-15-2019
    Location
    Connecticut, USA
    MS-Off Ver
    Office 365
    Posts
    4

    Comparing 2 separate columns in 2 separate Excel sheets

    Hi All,

    I'm not sure if this is the right part of the forum, I don't know if it's a formula or a macro I need. I have 2 separate Excel sheets where I need to compare 2 columns in one sheet to 2 columns in another sheet to find duplicates between the 2 sheets.
    Here is the more detailed situation:
    I have a listing that details subject visits. I need to contact doctors based on some of these subject visits.
    Each month a new listing is pulled, and the Excel listing that shows these subject visits is only supposed to pull new listings, but we got a new programmer and they don't know how to do that yet, so they pulled the entire, several thousand visit listing. I have already contacted doctors based on most of these visits, which I have tracked in a separate log. I need to compare the tracking log to the full log to see which subjects were already contacted about which visit.

    Let's say subject 1234 comes in for Visit 1, Visit 2 and Visit 3. I may have already contacted the doctor about Visit 1 and 2, but not Visit 3. I need a way to compare the 2 logs that tracks both subject number and visit name (ensuring, for example, "subject 1234, visit 1" is always linked together in each sheet). Going through it manually will take me a week, so I was hoping there was some kind of formula (or maybe macro?) that could help me do this, especially since my boss gave me a contradicting order on how to go about this. (contact the doctors for new visits, but don't review the log for it).

    Is this something that's possible?

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Comparing 2 separate columns in 2 separate Excel sheets

    Attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Registered User
    Join Date
    07-15-2019
    Location
    Connecticut, USA
    MS-Off Ver
    Office 365
    Posts
    4

    Re: Comparing 2 separate columns in 2 separate Excel sheets

    I have attached an example file, which is very similar to the real file in all but size. The real fie contains thousands of entries, so manual review would take a very long time, especially since a new listing is to be pulled soon. On the second tab (titled "Full Query File") I have highlighted in Green the issues that were already addressed per the 'Query Issued" tab. I would, ideally, like the full query file (tab 2) to highlight which issues were already addressed per the "Query issued" tab.
    Attached Files Attached Files

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Comparing 2 separate columns in 2 separate Excel sheets

    You can use PowerQuery to merge the two tables. Format data in both sheets as tables, named "QueryIssued" and "FullQuery" respectively.

    Then use this query to load to the FullQuery table:

    Please Login or Register  to view this content.
    This will retrieve the Date Sent from matching Query Issued records. Note this looks for matches in all four fields: "Location", "Subject #", "Visit", "Issue #"

    Finally, apply conditional formatting to highlight rows with Date Sent values.

    Example workbook attached.
    Attached Files Attached Files
    Last edited by Olly; 07-17-2019 at 03:02 AM.

  5. #5
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Comparing 2 separate columns in 2 separate Excel sheets

    Formula for A2 for CF then format copied to other cells

    =COUNTIFS('Query Issued'!$A$2:$A$16,$A2,'Query Issued'!$C$2:$C$16,$C2)

    or

    Select the range A2:D22 then apply formula for CF.
    Attached Files Attached Files
    Last edited by kvsrinivasamurthy; 07-17-2019 at 07:57 AM.
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  6. #6
    Registered User
    Join Date
    07-15-2019
    Location
    Connecticut, USA
    MS-Off Ver
    Office 365
    Posts
    4

    Re: Comparing 2 separate columns in 2 separate Excel sheets

    Thanks for your replies. I will need to get approval from IT to download PowerQuery, as I do not seem to have it installed. I tried the formula in the meantime and keep getting the #VALUE! error, though I copy+pasted exactly. Maybe I'm not linking it right? I am also unsure of what "CF" is.

  7. #7
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Comparing 2 separate columns in 2 separate Excel sheets

    Your profile says you are using Office 365 - Power Query is built in to Excel 365. It's labelled as "Get & Transform Data"

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,824

    Re: Comparing 2 separate columns in 2 separate Excel sheets

    FYI, DuHast, Get & Transform is on the Data ribbon.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  9. #9
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Comparing 2 separate columns in 2 separate Excel sheets

    CF means conditional formatting.

  10. #10
    Registered User
    Join Date
    07-15-2019
    Location
    Connecticut, USA
    MS-Off Ver
    Office 365
    Posts
    4

    Re: Comparing 2 separate columns in 2 separate Excel sheets

    Quote Originally Posted by Olly View Post
    You can use PowerQuery to merge the two tables. Format data in both sheets as tables, named "QueryIssued" and "FullQuery" respectively.

    Then use this query to load to the FullQuery table:

    Please Login or Register  to view this content.
    This will retrieve the Date Sent from matching Query Issued records. Note this looks for matches in all four fields: "Location", "Subject #", "Visit", "Issue #"

    Finally, apply conditional formatting to highlight rows with Date Sent values.

    Example workbook attached.
    I needed some additonal help to understand how to work the code, but I mostly got it to work, thank you for your help!

  11. #11
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Comparing 2 separate columns in 2 separate Excel sheets

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. You may also 'add reputation' to those who helped. 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. Comparing columns in separate workbooks
    By Netlon in forum Excel General
    Replies: 3
    Last Post: 05-23-2018, 04:57 AM
  2. Separate and align rows from two separate sheets based on a cell value.
    By Sonny Crockett in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-25-2015, 09:15 PM
  3. [SOLVED] Macro needed to Concatenate data in 2 separate tables of 2 separate sheets
    By 823 in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 02-08-2015, 02:02 PM
  4. [SOLVED] Comparing Two Columns from Separate Worksheets
    By alcharbonneau in forum Excel General
    Replies: 4
    Last Post: 06-11-2012, 09:15 PM
  5. Replies: 4
    Last Post: 11-22-2010, 12:57 PM
  6. Replies: 3
    Last Post: 08-12-2010, 03:45 PM
  7. Comparing two columns in two separate files
    By K Landsworth in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 06-15-2006, 06:45 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