+ Reply to Thread
Results 1 to 8 of 8

Removing duplicate text in a single line

  1. #1
    Registered User
    Join Date
    01-20-2006
    Posts
    9

    Red face Removing duplicate text in a single line

    Hey all -

    So, here's the story -

    I have many lines of text, split into rows. Several rows have a piece of information that is duplicating and I want to keep the first instance, but remove the rest.

    Example:
    Row 1: Jiojo GGHH jfioj GGHH jiojio.
    Row 2: Bdejjjfeij GGHH ufuheuuihuifhiue GGHH fjiofjwefjoii GGHH
    Row 3: Njidiikwl ojdijo idjwoji GGHH jiojooj GGHH ffjwofw.

    Basically, I'm looking for a way to remove all but one instance of GGHH only per row.

    Someone else already provided a code that works well for removing duplicates in a row, but I need to customize it to only remove instances of say, GGHH and leave the rest of the text alone.

    Here's the code provided:

    Please Login or Register  to view this content.
    If anyone has any suggestions, I would be grateful!!

    Thanks!
    Last edited by bwallan; 09-14-2015 at 02:11 AM.

  2. #2
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: Removing duplicate text in a single line

    Try this: (untested, but should work)

    Please Login or Register  to view this content.
    Please click the * below if this helps

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Removing duplicate text in a single line

    UDF

    Use in cell like

    =RemoveDupsFromCell(A1,"GGHH")
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by jindon; 09-14-2015 at 02:23 AM.

  4. #4
    Registered User
    Join Date
    01-20-2006
    Posts
    9

    Re: Removing duplicate text in a single line

    Thanks so much, but I only get an error message: Run Time Error 9: Subscript out of range

  5. #5
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: Removing duplicate text in a single line

    Use mine as a UDF:

    Please Login or Register  to view this content.
    Put in a cell : =Excelforum(A1, "GGHH")
    (where A1 is whatever cell you're trying to remove duplicates from)

  6. #6
    Registered User
    Join Date
    01-20-2006
    Posts
    9

    Re: Removing duplicate text in a single line

    Ah yes! Thank you so much, it does exactly what I need. THank you!!!

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Removing duplicate text in a single line

    You are welcome and thanks for the rep.

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

  8. #8
    Valued Forum Contributor
    Join Date
    03-22-2013
    Location
    Australia,NSW, Wirrimbi
    MS-Off Ver
    Excel 2013
    Posts
    1,057

    Re: Removing duplicate text in a single line

    BY default.. if information is duplicated in a string... I would not think that it needs to make a proper 'English' sentence (unless very poor grammar)..?? therefore.. going on that.. assuming you don't care where the duplicate value is shown in the resultant string.. try:

    Please Login or Register  to view this content.
    Last edited by apo; 09-14-2015 at 10:36 AM.

+ 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] Removing duplicate words in a text tring seperated by a commas within a single cell
    By syncguy in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-29-2015, 03:11 PM
  2. Removing Unknown Duplicate Text
    By Byronyk in forum Excel General
    Replies: 3
    Last Post: 12-22-2014, 02:19 PM
  3. Removing partial text in a line
    By Fugly in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-24-2013, 08:45 AM
  4. Replies: 7
    Last Post: 02-10-2013, 02:10 AM
  5. Read the text in a single cell line by line.
    By moon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-14-2010, 06:23 AM
  6. Removing Duplicate Entries [both text and number]
    By MetalUrge in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-14-2006, 05:13 AM
  7. Duplicate Text within single cell. How to identify & split
    By TeRex82 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-21-2006, 03:35 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