Closed Thread
Results 1 to 11 of 11

Find duplicate characters in a cell?

  1. #1
    Registered User
    Join Date
    02-05-2011
    Location
    Virginia
    MS-Off Ver
    Excel 2003
    Posts
    3

    Find duplicate characters in a cell?

    Hey everyone,

    I'm really hoping that this isn't a stupid question or worse, one that's been answered and that I just couldn't find using the search function.

    The background to my problem is that I'm trying to create a unique dictionary for a game I'm programming. I have imported the dictionary into Excel and need to manipulate it with the following conditions:
    • Word length can only be 3-5 characters long
    • Word cannot contain special characters like hyphen or apostrophe
    • Word cannot have repeated characters

    I got the first two criteria done using pretty brute for methods. The first using the LEN function to find words greater than 2 and those less than 6 and then comparing those two lists to get the list of 3-5 character words. The second I did manual search for characters and replaced them with six random characters so they would fail criteria 1 and be filtered out.

    The last one I'm having problems figuring out. The game I'm programming only lets you use a letter once. So words like "dad" (or coincidentally enough "mom") would not be valid.

    Is there a way I can look at the words in the cell and see if any character is repeated and then act upon that (e.g., copy to another column if no letters are repeated)?

    Thanks in advance!

    ~Paik

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Find duplicate characters in a cell?

    With
    A1 containing a word...
    This formula will return the count of the most ocurring character:
    Please Login or Register  to view this content.

    Examples:
    Please Login or Register  to view this content.

    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Registered User
    Join Date
    02-05-2011
    Location
    Virginia
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Find duplicate characters in a cell?

    That's fantastic. That's will work perfectly. I can use the resultant value to get what I need. I just have to make sure all the words are the same case since the value for "A" is different than "a".

    Since I need the count to be 1, I can just do another column to make sure the value in that column is 1.

    Thanks a lot, Ron!

    ~Paik

  4. #4
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Find duplicate characters in a cell?

    If you want the test to be case-INsensitive...try this variation:
    Please Login or Register  to view this content.
    I hope that helps.
    Last edited by Ron Coderre; 02-06-2011 at 12:45 AM.

  5. #5
    Registered User
    Join Date
    02-05-2011
    Location
    Virginia
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Find duplicate characters in a cell?

    Thanks for the additional help. I just changed the source file to all lowercase using my text editor so I didn't need to worry about it. I really appreciate the help, it saved me a lot of heartburn!

    ~Paik

  6. #6
    Registered User
    Join Date
    07-13-2013
    Location
    Ukraine
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Find duplicate characters in a cell?

    2Ron Coderre
    Amazing. It took me half an hour to understand how it works.

  7. #7
    Registered User
    Join Date
    09-15-2012
    Location
    Noida
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: Find duplicate characters in a cell?

    How to remove this duplicates text from a cell

  8. #8
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Find duplicate characters in a cell?

    Rajesh,

    Unfortunately you need to post your question in a new thread, it's against the forum rules to post a question in the thread of another user. If you create your own thread, any advice will be tailored to your situation so you should include a description of what you've done and are trying to do. Also, if you feel that this thread is particularly relevant to what you are trying to do, you can surely include a link to it in your new thread.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  9. #9
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Find duplicate characters in a cell?

    Rajesh,

    Unfortunately you need to post your question in a new thread, it's against the forum rules to post a question in the thread of another user. If you create your own thread, any advice will be tailored to your situation so you should include a description of what you've done and are trying to do. Also, if you feel that this thread is particularly relevant to what you are trying to do, you can surely include a link to it in your new thread.

  10. #10
    Registered User
    Join Date
    06-02-2022
    Location
    Palm Springs
    MS-Off Ver
    365
    Posts
    7

    Re: Find duplicate characters in a cell?

    Hi, Ron! I've been trying to use your formula to get the count of the most frequently occurring character in each one of an range of cells in a column, all containing text, and not having any luck when I start in the beginning row and try to populate the formula across each succeeding cell. Would you have any suggestions for changing the formula to cover multiple items?

    Thanks!

    Rob McCann

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Find duplicate characters in a cell?

    Please don't post in an ancient thread. Start your own thread and (preferably) attach s sample sheet meeting forum guidleines (see yellow banner - top of page).
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

Closed 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