+ Reply to Thread
Results 1 to 7 of 7

Find duplicate rows across several columns with conditions and high light them

  1. #1
    Registered User
    Join Date
    09-22-2010
    Location
    US
    MS-Off Ver
    O365 (PC) V 2308
    Posts
    62

    Find duplicate rows across several columns with conditions and high light them

    How can I find duplicates rows on several columns with conditions and high light them?

    Certain conditions to check
    1) if group is in ALF or Assisted Living Facility (both are same ) only high light the latest date_received record.
    2)If CMS and FMID fields are different then need to keep both records. other wise keep only one record.
    3)No need to check for staff number column.

    Is this possible to do it in excel? Some times address have acronyms instead of full word( like Rd or Road, Av Vs Avenue).

    Goal is to easily identify duplicate submissions in about 10,000 records and 45 columns.

    Thank you in advance.
    Attached Files Attached Files

  2. #2
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Find duplicate rows across several columns with conditions and high light them

    Finding duplicate records is generally a database feature that's not really what spreadsheet programs are for period although you can do this sort of thing in a spreadsheet program like excel. My advice personally would be to export your sheet to a Microsoft Access table and then run the query wizard because it has a find duplicates template query inside of it. then you can simply change the SQL it spits out and put a delete statement in instead of a select statement and then export the resulting table back out to excel where you got it from. I'm no expert but I've never done this in Excel without using the Ado dll library. That library allows you to query out records in an Excel spreadsheet just like a Microsoft Access query does. but the complex part of working with that library is that you have to create connection objects first.

  3. #3
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Find duplicate rows across several columns with conditions and high light them

    Base on your sample, please try Conditional formatting applies to A2:I7

    =$A2=MAX(INDEX($A$2:$A$7*($D$2:$D$7=$D2)*($E$2:$E$7=$E2)*($B$2:$B$7=$B2),))
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    09-22-2010
    Location
    US
    MS-Off Ver
    O365 (PC) V 2308
    Posts
    62

    Re: Find duplicate rows across several columns with conditions and high light them

    Bo_Ry, can you explain what exactly does this do? Can I add more fields?
    Thank you so much. Looks like I am close to the solution but need some time to understand this formula to expand to other duplicate fields

  5. #5
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Find duplicate rows across several columns with conditions and high light them

    =MAX(INDEX($A$2:$A$7*($D$2:$D$7=$D2)*($E$2:$E$7=$E2)*($B$2:$B$7=$B2),))

    Find maximum date base on Facility_Name, CMS, FMID
    I didn't use Address1 and Group because of inconsistent words like Rd or Road and ALF or Assisted Living Facility.

    Then compare the maximum date with date on that row =$A2=Max(…

  6. #6
    Registered User
    Join Date
    09-22-2010
    Location
    US
    MS-Off Ver
    O365 (PC) V 2308
    Posts
    62

    Re: Find duplicate rows across several columns with conditions and high light them

    Some times I noticed there are 3 records, what changes can I make to captures those duplicates.
    I added F and H and not sure if that is working as I have more than 50,000 records.
    =MAX(INDEX($A$2:$A$7*($D$2:$D$7=$D2)*($E$2:$E$7=$E2)*($F$2:$F$7=$F2)*($H$2:$H$7=$H2)*($B$2:$B$7=$B2),))

    One other issue I am having is I try to make small subset by state to handle this formula but the challenge is I need to identify the end row number to change this formula each time. Any trick?

    Thank you so much for helping me

  7. #7
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,531

    Re: Find duplicate rows across several columns with conditions and high light them

    To make the formula in post #6 work, since ALF and Assisted Living Facility are the same, I added a helper column (J) and modified the formula to reference column J instead of column F.
    J2 and down are populated using: =SUBSTITUTE(F2,"Assisted Living Facility","ALF")
    The formula could then read: =A2=MAX(INDEX($A$2:$A$7*($D$2:$D$7=$D2)*($E$2:$E$7=$E2)*($J$2:$J$7=$J2)*($H$2:$H$7=$H2)*($B$2:$B$7=$B2)*(G$2:G$7=G2),))
    Note that a reference to column G has been added so that facilities in the same state will be grouped.
    I suggest applying this strategy to the actual data set and then posting back with one or two examples where the formula doesn't return the expected result.
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

+ 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. [SOLVED] How To High light using Conditional Formating
    By azbi in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 05-08-2018, 03:42 AM
  2. [SOLVED] high light active cell row
    By iqss in forum Excel General
    Replies: 3
    Last Post: 02-24-2018, 03:04 AM
  3. Replies: 4
    Last Post: 01-29-2018, 09:08 AM
  4. High light Low value
    By reshujai in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-17-2014, 01:06 AM
  5. High light cells that are above a given figure
    By solid_state in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 09-02-2009, 04:42 AM
  6. high-light certain cell
    By Philangr8 in forum Excel General
    Replies: 3
    Last Post: 08-20-2009, 03:47 PM
  7. [SOLVED] high light row your working in
    By kcholly in forum Excel General
    Replies: 3
    Last Post: 03-29-2005, 04:06 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