+ Reply to Thread
Results 1 to 12 of 12

Remove duplicate lines based on another cell field

  1. #1
    Registered User
    Join Date
    10-02-2023
    Location
    Lisbon
    MS-Off Ver
    Microsoft 365 Apps for Enterprise
    Posts
    5

    Remove duplicate lines based on another cell field

    Hi there!

    Im fairly new in Excel, although capable of some formulas and Data tools hacks, but theres a problem that I cant seem to find a solution for either online or with friends.
    I have a database of candidates applying to my company stores. The database is already close do 10.000 lines and, as usual, there are some duplicates (people that apply more than once, etc). When Im looking for candidates to a specific store location, I simply filter the database in the City column and pick the candidates.
    Ideally, I would want only one line for one specific individual, except when, for example, Jack wants to apply for a store in Washington and also in Denver. Therefore, either I filter Washington or Denver, Jacks name is going to come up.

    I already have the Highlight Duplicate Values in the phone number, and if I go with Remove Duplicates Im solving the duplicates problem HOWEVER Im damaging this last example, losing a candidate for Denver just because he already had a line for Washington.

    (see databse example attached)

    I try to do it manually and order the list from candidates unique ID number, highlight duplicates and manually delete lines where the candidate has selected the same city (a pure duplicate). But with close to 10.000 lines its tiresome.
    As the example below of the real database structure (but with false contacts) Im looking for a solution that can automatically delete the latest of the Richard Plumber lines (because it has the same city and its a pure duplicate) BUT keep both of Jack Kent lines, because although his personal information is the same, hes applying for two cities and I have to keep both entries.


    I guess Im looking for a way to automate the deletion of a repeated line with the same phone number only if the cell in the City field is the same, and keep it if its different. Is there a way to automate this?
    Attached Files Attached Files
    Last edited by rickpd; 10-04-2023 at 04:43 AM. Reason: Solved

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: Remove duplicate lines based on another cell field

    Try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    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,969

    Re: Remove duplicate lines based on another cell field

    Welcome to the forum.

    Try this in A9 - does it give what you want?

    =UNIQUE(CHOOSECOLS(A1:G7,2,3,4,5,7))

    =EXCLUSIVOS(CHOOSECOLS(A1:G7;2;3;4;5;7))
    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.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: Remove duplicate lines based on another cell field

    Using all the fields:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,895

    Re: Remove duplicate lines based on another cell field

    An alternative to the formulas provided here is an option with Power Query

    Please Login or Register  to view this content.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  6. #6
    Registered User
    Join Date
    10-02-2023
    Location
    Lisbon
    MS-Off Ver
    Microsoft 365 Apps for Enterprise
    Posts
    5

    Re: Remove duplicate lines based on another cell field

    All right!

    It worked! Didnt expect a formula for this could be so short

    Thank you very much!

  7. #7
    Registered User
    Join Date
    10-02-2023
    Location
    Lisbon
    MS-Off Ver
    Microsoft 365 Apps for Enterprise
    Posts
    5

    Re: Remove duplicate lines based on another cell field

    Quote Originally Posted by TMS View Post
    Try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    All right!

    It worked! Didnt expect a formula for this could be so short

    Thank you very much!

  8. #8
    Registered User
    Join Date
    10-02-2023
    Location
    Lisbon
    MS-Off Ver
    Microsoft 365 Apps for Enterprise
    Posts
    5

    Re: Remove duplicate lines based on another cell field

    Quote Originally Posted by AliGW View Post
    Welcome to the forum.

    Try this in A9 - does it give what you want?

    =UNIQUE(CHOOSECOLS(A1:G7,2,3,4,5,7))

    =EXCLUSIVOS(CHOOSECOLS(A1:G7;2;3;4;5;7))
    Attachment 844483

    Thank you in advance for your help.

    The formula is asking me for further inputs...or Im not reading yours right. I have the same database on Sheet 1 and he asks for some True/False entries. Am I doing something wrong? (see attached image pls)

  9. #9
    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,969

    Re: Remove duplicate lines based on another cell field

    Can you not see the difference yourself? You have Sheet3! At the end where you need the closing bracket.

  10. #10
    Registered User
    Join Date
    10-02-2023
    Location
    Lisbon
    MS-Off Ver
    Microsoft 365 Apps for Enterprise
    Posts
    5

    Re: Remove duplicate lines based on another cell field

    Sorry. Because the formula kept asking me for arguments I didn't know I could end it with a bracket right there.

    It works perfectly! Thank you very much indeed!
    Last edited by AliGW; 10-04-2023 at 04:41 AM. Reason: Please do NOT quote unnecessarily!

  11. #11
    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,969

    Re: Remove duplicate lines based on another cell field

    Glad to have helped.

    If that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, if you have not already done so, you may not be aware that you can thank anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of each of those who offered help.

  12. #12
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: Remove duplicate lines based on another cell field

    Quote Originally Posted by rickpd View Post
    All right!

    It worked! Didnt expect a formula for this could be so short

    Thank you very much!


    You're welcome. Thanks for the rep.

+ 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. macro to remove duplicate lines and correct the data 2 columns
    By excel_rooki in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-07-2023, 12:24 PM
  2. [SOLVED] Remove duplicate date lines in cells
    By brentjohn in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-13-2018, 01:48 PM
  3. [SOLVED] Remove duplicate values in Field cell from same column
    By nironto in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-22-2016, 01:40 AM
  4. [SOLVED] Remove lines based on cell value (remove lines in range, not entire row)
    By Tapyr in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-27-2015, 07:31 AM
  5. splitting one sheet into several others based on a field, how to get rid of lines
    By Suzanne Hawkins in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-23-2015, 06:30 PM
  6. Average lines based on field?
    By rmwork in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-13-2013, 03:54 PM
  7. remove duplicate lines, but not delete rows
    By loade in forum Excel General
    Replies: 3
    Last Post: 09-26-2011, 01:12 AM

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