+ Reply to Thread
Results 1 to 14 of 14

highlight cells that contain the same first 5 characters

  1. #1
    Registered User
    Join Date
    04-16-2013
    Location
    North Dakota
    MS-Off Ver
    Excel 2010
    Posts
    10

    highlight cells that contain the same first 5 characters

    Hi everyone,

    I was hoping someone could help me. I need to find out if there is a formula I can use in conditional formatting. If I have data such as:

    ZR234-123456
    TS123-456789
    ZR234-645678

    I need to figure out a way to highlight the cells that have the same first 5 letters/numbers. Not sure if that's possible?

    Thank you!!!
    Last edited by goldstar1; 04-16-2013 at 10:00 AM.

  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: Help- Formula

    try this
    =(COUNTIF($A$3:$A$30,LEFT(A3,5)&"*")>1)

    see attached
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    04-16-2013
    Location
    North Dakota
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: highlight cells that contain the same first 5 characters

    I tried the formula that etaf provided, but it didn't work for me...Here's a larger example of data if it would help.

    LI007-278936588
    IS139-278806003
    IS139-279000332
    IS141-278781674
    IS141-278781678
    IS141-278781680
    IS023-278781687
    IS023-278781690
    IS001-278781692
    IS489-278781695
    IS976-278781696
    IS141-278781698
    LI007-279005411
    ZB436-279019742
    ZB436-279028342
    ZB437-279447040
    RA085-278751643
    RA088-279464874
    RA085-279490191
    AM099-279473098
    AM120-279118094

  4. #4
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: highlight cells that contain the same first 5 characters

    etaf, uploded a sample workbook to show his suggestion. Pls do the same. Upload a sample workbook.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  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 contain the same first 5 characters

    as requested a sample spreadsheet now

    I added the extended data into my example and reloaded here
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    04-16-2013
    Location
    North Dakota
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: highlight cells that contain the same first 5 characters

    I found a solution that seems to work best for what I'm looking for. I decided to just separate the data with text to columns and use a countif formula =COUNTIF($A$1:$H$100,A1)>3 in the conditional formatting use a formula option to show me specifically which cells contain the same 5 characters that appear 4 or more times.

    I didn't previously ask about the specific number of occurences. I would have been happy with just showing duplicates, but the more specific the better

    Thank you all for all your 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 contain the same first 5 characters

    Does that work - as its looking at the whole string and not the 1st 5 characters
    =COUNTIF($A$1:$H$100,A1)>3

    as post #2
    my formula is the same
    =(COUNTIF($A$3:$A$30,LEFT(A3,5)&"*")>1)
    only it looks at the 1st 5 characters

    so changing to the same ranges as yours
    =(COUNTIF($A$1:$H$100,LEFT(A1,5)&"*")>1)

    you are also comparing A1 across columns A to H ?

  8. #8
    Registered User
    Join Date
    04-16-2013
    Location
    North Dakota
    MS-Off Ver
    Excel 2010
    Posts
    10

    Highlighting all four cells

    Hi benishiryo,

    Attached is a new WB.
    Attached Files Attached Files

  9. #9
    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: Highlighting all four cells

    you need to explain what you are trying to do - with a lot more detail please

  10. #10
    Registered User
    Join Date
    04-16-2013
    Location
    North Dakota
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Highlighting all four cells

    Hi etaf,

    benishiryo was assisting me in creating a formula that will be used in conditional formatting to highlight only dates that are the same and appear consecutevly 4 or more times.

  11. #11
    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: Highlighting all four cells

    you have started a new thread - so you probably need to reply to the post where you are already getting help and not start a new thread here

    so here
    http://www.excelforum.com/excel-form...25#post3200725

  12. #12
    Registered User
    Join Date
    04-16-2013
    Location
    North Dakota
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Highlighting all four cells

    I was asked to start a new thread so I did. If I shouldn't have then I'm sorry.

  13. #13
    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: Highlighting all four cells

    no , if you are starting a new thread - then you do need to give all the supporting information and detail for what you would like to achieve as new people will not know what you want to now achieve

    =COUNTIF($A$1:$A$200,A1)>4

    so A is the column you have the dates change that to the column with the dates and the range - not sure which columns A, L or M

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

    Re: highlight cells that contain the same first 5 characters

    Thanks etaf.

    The threads have now been merged.
    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]

+ 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