+ Reply to Thread
Results 1 to 4 of 4

Removing Partial Duplicates and Keeping the Long String Value

  1. #1
    Registered User
    Join Date
    09-13-2017
    Location
    United States
    MS-Off Ver
    MS Office 365
    Posts
    43

    Removing Partial Duplicates and Keeping the Long String Value

    Hi,

    I am not sure if the title explains what I am trying to achieve but I want to find a formula that can look through the list of partial duplicates and extracting the longest string value. Attached is an example of what I am trying to achieve. If there is no formula that can do this, is there a vba code that can?

    Thank you!
    Attached Files Attached Files

  2. #2
    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,719

    Re: Removing Partial Duplicates and Keeping the Long String Value

    Why are you discarding Shirt_170511_010000-JJ when it is longer than Shirt_170511_010000?

    Will the longest version always come last in the original list, or could it appear anywhere?
    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.

  3. #3
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,908

    Re: Removing Partial Duplicates and Keeping the Long String Value

    1. Remove Duplicates.

    2. Try this in D2:

    =IFERROR(INDEX(A:A,AGGREGATE(15,6,ROW($A$2:$A$9)/(COUNTIF($A$2:$A$9,$A$2:$A$9&"*")=1),ROWS($D$2:D2))),"")

  4. #4
    Registered User
    Join Date
    09-13-2017
    Location
    United States
    MS-Off Ver
    MS Office 365
    Posts
    43

    Re: Removing Partial Duplicates and Keeping the Long String Value

    Quote Originally Posted by AliGW View Post
    Why are you discarding Shirt_170511_010000-JJ when it is longer than Shirt_170511_010000?

    Will the longest version always come last in the original list, or could it appear anywhere?
    My apologies AliGW, it should have been Shirt_170511_010000-JJ and not Shirt_010000. Thanks for pointing that out.

    Quote Originally Posted by Phuocam View Post
    1. Remove Duplicates.

    2. Try this in D2:

    =IFERROR(INDEX(A:A,AGGREGATE(15,6,ROW($A$2:$A$9)/(COUNTIF($A$2:$A$9,$A$2:$A$9&"*")=1),ROWS($D$2:D2))),"")
    Thank you for the code Phuocam, so far it is working. Do you mind explain on how you thought of this code?

    Thank you both so much for replying to this topic!

+ 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. Removing partial duplicates in a large data set in excel for mac
    By adam_d_john in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-17-2017, 12:25 PM
  2. [SOLVED] Removing duplicates from column A while keeping their respective values from column B
    By joel.mugabe in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-19-2016, 02:38 AM
  3. [SOLVED] Removing Duplicates - while keeping original data series
    By tomdriscoll in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 04-01-2014, 08:24 PM
  4. Replies: 1
    Last Post: 10-19-2011, 06:14 PM
  5. Problems removing duplicates from a LONG list based on conditions
    By metalpoker in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-10-2011, 06:36 AM
  6. Replies: 1
    Last Post: 08-29-2010, 12:06 PM
  7. removing duplicates in a string of text
    By zapszipszops in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-28-2008, 09:54 PM

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