+ Reply to Thread
Results 1 to 10 of 10

Highlight cells that contains characters repeated x times in the whole sheet

  1. #1
    Registered User
    Join Date
    10-01-2018
    Location
    Bergen, Norway
    MS-Off Ver
    2016
    Posts
    5

    Highlight cells that contains characters repeated x times in the whole sheet

    Hi !

    I have a big dataset composed of gene ID names (ex. v1g32789). I would like to find a way to highlight the cells that contain an ID that is repeated more than once but less than 4 times in the whole sheet. I don't have an ID of reference, I would like to identify the ones that are present between 2 and 4 times.
    I have tried COUNTIF functions as described in other posts such as =COUNTIF($A$2:$E$301,$A1)>2 just to try it out, but I always get an error message and can't figure out why. Plus I need to be able to set an upper limit to the number of duplicates.

    Does anyone have an idea on how to achieve that ?

    Thanks in advance !

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,751

    Re: Highlight cells that contains characters repeated x times in the whole sheet

    should work
    try

    =AND(COUNTIF($A$2:$E$301,$A1)>=2, COUNTIF($A$2:$E$301,$A1)<=4)

    But if its in 5 times then it will not count


    select the range and use formula
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Registered User
    Join Date
    10-01-2018
    Location
    Bergen, Norway
    MS-Off Ver
    2016
    Posts
    5

    Re: Highlight cells that contains characters repeated x times in the whole sheet

    Thank you so much ! That does make a lot of sense ! But sadly I got the same error message than before, "There's a problem with this formula. Not trying to type a formula ? blablabla..."
    So frustrating... I really don't know what I'm doing wrong.

    I did Home > Styles > Conditional formatting > New Rule > Use a formula to determine which cells to format
    ...and then entered the formula, that already had the proper range for the sample of my dataset that I wanted to try it on. I set a highlight color under 'Format...', pressed OK and the error message popped up.

    Is there anything obvious that I am doing wrong ?

  4. #4
    Registered User
    Join Date
    10-01-2018
    Location
    Bergen, Norway
    MS-Off Ver
    2016
    Posts
    5

    Re: Highlight cells that contains characters repeated x times in the whole sheet

    Hi again, I found the problem ! My separator (...I hope that's the right word) didn't match your formula I changed it from ';' to ',' and now it works just fine. Dammit Norway.

    Thank you so much, you made my day !

  5. #5
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,751

    Re: Highlight cells that contains characters repeated x times in the whole sheet

    you are welcome

  6. #6
    Registered User
    Join Date
    10-01-2018
    Location
    Bergen, Norway
    MS-Off Ver
    2016
    Posts
    5

    Re: Highlight cells that contains characters repeated x times in the whole sheet

    Yeah actually another problem appeared :/ The formula seems to highlight only whole rows. Some of the cells that are highlighted contain indeed an ID that is repeated 2 to 4 times in the worksheet, but not all duplicates are highlighted. And some of the highlighted cells contain ID that are not repeated, it looks like they were only highlighted because they are on the same row as repeated ones...

    So in the end it does not work at all for my purpose I got excited a bit too fast ! Any idea of what changes would help ?

  7. #7
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,751

    Re: Highlight cells that contains characters repeated x times in the whole sheet

    =AND(COUNTIF($A$2:$E$301,$A1)>=2, COUNTIF($A$2:$E$301,$A1)<=4)

    this is counting based on column A

    if you want to count within the area
    A2 to E301

    change to
    =AND(COUNTIF($A$2:$E$301,A2)>=2, COUNTIF($A$2:$E$301,A2)<=4)

  8. #8
    Registered User
    Join Date
    10-01-2018
    Location
    Bergen, Norway
    MS-Off Ver
    2016
    Posts
    5

    Re: Highlight cells that contains characters repeated x times in the whole sheet

    IT WORKS

    YAASS

    Thanks !!

  9. #9
    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
    81,009

    Re: Highlight cells that contains characters repeated x times in the whole sheet

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
    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.

  10. #10
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,751

    Re: Highlight cells that contains characters repeated x times in the whole sheet

    you are welcome

+ 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 macro to count & highlight cells with non-ASCII characters
    By Dimitris254 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-20-2016, 09:09 AM
  2. Replies: 5
    Last Post: 09-25-2014, 07:00 AM
  3. highlight 2 cells with times of day that overlap
    By Kshari in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 06-19-2014, 11:13 PM
  4. [SOLVED] Highlight cells that are over 100 characters
    By jsz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-06-2013, 10:51 AM
  5. highlight cells that contain the same first 5 characters
    By goldstar1 in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 04-17-2013, 02:24 PM
  6. Checking for repeated characters in the excels sheet's row
    By Abhushan86 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-30-2012, 09:44 AM
  7. 2003 - Highlight only repeated cells
    By samboytor in forum Excel General
    Replies: 1
    Last Post: 06-21-2011, 12:13 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