+ Reply to Thread
Results 1 to 5 of 5

Remove duplicates in Excel 2016 text string in one cell

  1. #1
    Registered User
    Join Date
    08-30-2017
    Location
    Spain
    MS-Off Ver
    2016
    Posts
    2

    Remove duplicates in Excel 2016 text string in one cell

    Hello Excel experts,

    I have a long Excel with the following text:

    "We must have this must have" Text is in one cell seperated with empty spaces

    Desired result is:

    "We must have this"

    Any VBA macro to clean this out?

    Thanks in advance

  2. #2
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Remove duplicates in Excel 2016 text string in one cell

    Try this
    1. Copy code below
    2. Press Alt and F11 on your keyboard to open VB Editor
    3. Click on Insert and select Module
    4. Paste code into Module and close VB Editor.

    Don't forget to save your worbook as Macro-Enabled workbook.

    Please Login or Register  to view this content.
    then use FORMULA
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    v A B
    1 We must have this must have We must have this
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  3. #3
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,045

    Re: Remove duplicates in Excel 2016 text string in one cell

    Quicker (to solve - took me 1 minute) with a formula

    in B1
    IF(AND(RIGHT(A1,10)=" must have",LEN(A1)>10),LEFT(A1,LEN(A1)-10),A1)
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  4. #4
    Registered User
    Join Date
    08-30-2017
    Location
    Spain
    MS-Off Ver
    2016
    Posts
    2

    Re: Remove duplicates in Excel 2016 text string in one cell

    Dear Alkey,

    thanks a lot for your help and quick answer. I followed all steps, saved the workbook with macro-enabled option. I get the following error message when I copy the formula:"Ambiguous name detected: RemoveDupes"

    error message.png

  5. #5
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Remove duplicates in Excel 2016 text string in one cell

    That means you have another procedure with the same name "RemoveDupes" so change the old one to "RemoveDupesOld"
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

+ 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. VBA: remove duplicates from cell or string
    By JasperD in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-22-2017, 07:58 AM
  2. Excel 2016 remove duplicates
    By zyzzyva57 in forum Excel General
    Replies: 1
    Last Post: 01-25-2017, 10:11 PM
  3. [SOLVED] Concatinate string of text and remove duplicates
    By msmayhugh in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-20-2015, 06:38 PM
  4. remove duplicates from csv string
    By nikko50 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-28-2014, 01:24 PM
  5. Replies: 8
    Last Post: 12-04-2013, 12:49 PM
  6. Export a field from text file to excel and remove duplicates
    By premkrishnan in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 11-08-2011, 05:51 AM
  7. remove text before and/or after a string in a cell
    By hmatharo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-21-2008, 09:57 PM

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