+ Reply to Thread
Results 1 to 12 of 12

Remove duplicates inside the cells (with criteria)

  1. #1
    Forum Contributor
    Join Date
    12-12-2007
    Location
    Germany
    MS-Off Ver
    MS Office 2007 on Windows 10 (German Version)
    Posts
    105

    Remove duplicates inside the cells (with criteria)

    Hello,

    I have a worsheet "Is" which has a column D. Column D contains of words followed by their grammatical identities in "{}". Seperator for the words is ";".
    Now there are some words which are available multiple times but their grammtical identities inside "{}" differ. For example: " franc {adv.}; franc {m.}; franc {xy}; franc {??}". Now i have the word "franc" multiple times. I want to delete all those duplicates which dont have the grammatical identity "{m.}" or "{f.}". So the task is:

    a) find duplicates inside the cells of Column D/worksheet "is"
    b) delete all duplicates and leave only those which are followed by "{m.}" or "{f.}" . For example ( wordxy {adv.}; wordyy {adj.}; wordxy {m.}; wordxy {adj.} ==> wordyy {adj.}; wordxy {m.})
    c) if there are duplicates but non of them has the grammatical identity "{m.}" or "{f.}" then delete the duplicates and leave which ever has the first position. For example ( word25 {xy.}; word1 {adv.}; word2 {n.} ==> word25 {xy}; {word1 {adv.})

    I am attaching example wordlist along this thread and hope some one can help me clean this wordlist.
    Attached Files Attached Files
    Last edited by julia81; 04-11-2012 at 09:48 AM.

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Remove duplicates inside the cells (with criteria)

    Try this:-
    Results column "E".
    Please Login or Register  to view this content.
    Regards Mick

  3. #3
    Forum Contributor
    Join Date
    12-12-2007
    Location
    Germany
    MS-Off Ver
    MS Office 2007 on Windows 10 (German Version)
    Posts
    105

    Re: Remove duplicates inside the cells (with criteria)

    Hi Mick,

    thank you very much.

    I get an error when i run the code : " compiler Error: For without Next"

    thanks

  4. #4
    Forum Contributor
    Join Date
    02-07-2012
    Location
    MIA
    MS-Off Ver
    Excel 2007, 2010
    Posts
    429

    Re: Remove duplicates inside the cells (with criteria)

    It seems it should be like this:
    Please Login or Register  to view this content.
    .?*??)
    `?.???.?*??)?.?*?)
    (?.?? (?.?
    Pichingualas <---
    ??????????????????????????

    Wrap your code with CODE TAGS.
    Thank those who helped you, Don't forget to add to their REPUTATION!!! (click on the star below their post).
    Please mark your threads as [SOLVED] when they are (Thread Tools->Mark thread as Solved).

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

    Re: Remove duplicates inside the cells (with criteria)

    Different method
    Please Login or Register  to view this content.
    Last edited by jindon; 04-09-2012 at 06:58 PM.

  6. #6
    Forum Contributor
    Join Date
    12-12-2007
    Location
    Germany
    MS-Off Ver
    MS Office 2007 on Windows 10 (German Version)
    Posts
    105

    Re: Remove duplicates inside the cells (with criteria)

    duplicates.xlsmThank you very much! its running now but stops working on this line:

    nu {n. m. invar.}; nu {m.}

    it shows "runtime error 13: type mismatch"


    Secondly it produces new duplicates instead of deleting the old ones (is it because the macro doesnt run to the end?)(Edited: solved! I ran the macro twice which produced new duplicates)

    I am attaching a new example file with more data and hope it will run.
    Last edited by julia81; 04-09-2012 at 07:16 PM.

  7. #7
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Remove duplicates inside the cells (with criteria)

    The Problem was I Cut the Code short when copying !!!
    Change the line in red at the Bottom of the Code
    Please Login or Register  to view this content.
    Can you Sent the New File with a ".xls" extension and I'll have another look !!

  8. #8
    Forum Contributor
    Join Date
    12-12-2007
    Location
    Germany
    MS-Off Ver
    MS Office 2007 on Windows 10 (German Version)
    Posts
    105

    Re: Remove duplicates inside the cells (with criteria)

    @Jindon Hi,
    thank you very much for your code. As i was posting my last answer, i didnt saw your solution. But now i tried it and it runs till the end and does what i need it to. But it leaves many cells empty (doesnt process some cells). I am attaching a file with example data where your code doesnt process the cells. I have colored red those cells which are not processed by your code. Thes cells contain no {m.} and no {f.}. Is it the reason? In these cases duplicates should be deleted and which ever is in first position should be left. For example:
    acteur {n.}; comédien {adj. et n.}; comédien {n.} => acteur {n.}; comédien {adj. et n.}
    OR if its easier to do following, it will be a good solution for me as well:
    acteur {n.}; comédien {adj. et n.}; comédien {n.} => acteur {n.}; comédien

    @MickG
    thanks for the modification. I am attaching now the file in *.xls format. Thank you in advance.
    Attached Files Attached Files

  9. #9
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Remove duplicates inside the cells (with criteria)

    Try this:-
    Nb:- Your new file does not show the Expected result !!!
    Please Login or Register  to view this content.
    Regards Mick

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

    Re: Remove duplicates inside the cells (with criteria)

    Not sure if this is how you want
    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    12-12-2007
    Location
    Germany
    MS-Off Ver
    MS Office 2007 on Windows 10 (German Version)
    Posts
    105

    Re: Remove duplicates inside the cells (with criteria)

    @Jindon
    Thank you very much Jindon. My problem is solved as I first run you first macro and then the second. :-)Thaaaaanks

    @MickG
    It works now. Thank you very much


    @Pichingualas
    thank you very much for your help as well.

    You both cant imagine how much time i will save through this code. I processed over 40 000 rows with this code. Thank you both ver much.

  12. #12
    Forum Contributor
    Join Date
    02-07-2012
    Location
    MIA
    MS-Off Ver
    Excel 2007, 2010
    Posts
    429

    Re: Remove duplicates inside the cells (with criteria)

    Always glad to help, as little as my help was.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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