+ Reply to Thread
Results 1 to 4 of 4

Highlighting consecutive duplicates

  1. #1
    Registered User
    Join Date
    11-14-2017
    Location
    Alton, England
    MS-Off Ver
    2007
    Posts
    2

    Highlighting consecutive duplicates

    I have a sheet of about 30000 lines, I am trying to find a way to highlight when I have the same entry in both column C and D eg.

    23297 23297 H0572 C0154
    23296 23296 H0572 G0083
    21850 21850 H0681 S0729
    21851 21851 H0681 S0730
    23288 23288 H0571 S0705
    23289 23289 H0571 S0706
    21886 21886 H0681 S0694
    21842 21842 H0681 S0728
    23198 23198 H0703 S0312
    23202 23202 H0704 G0037
    23203 23203 H0704 G0088
    23201 23201 H0704 S0312
    23616 23616 H0705 C0161
    34118 34118 H0705 C0161

    23284 23284 H0570 G0083

    So the red I would need highlighting, but not the blue as the H code is not the same

    I hope that makes sense!

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Highlighting consecutive duplicates

    Hi,

    You can do that with conditional formatting using a formula. Assuming your data is sorted on columns C and D and starts in row 2 with headers in row 1, you would use a formula like
    =OR(AND($C1=$C2,$D1=$D2),AND($C3=$C2,$D3=$D2))
    applied to the range from A2 to the last cell in column D.

    If the data is not sorted, and can't be, the formula would need to change to something like
    =COUNTIFS($C:$C,$C2,$D:$D,$D2)>1
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Highlighting consecutive duplicates

    welcome to the forum. i was headed towards xlnitwit's first solution too because of your subject header, but it seems like you don't want the blue highlighted because column C is not the same? and not because they are not consecutive? if so, select the range you want to apply to (say from A2:D16)
    go to Home tab -> Conditional Formatting -> New Rule -> Use a formula to determine which cells to format -> Format values where this formula is true:
    =COUNTIFS($C:$C,$C2,$D:$D,$D2)>1
    format

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  4. #4
    Registered User
    Join Date
    11-14-2017
    Location
    Alton, England
    MS-Off Ver
    2007
    Posts
    2

    Re: Highlighting consecutive duplicates

    thank you both, benishiryo that work's perfectly. You're right I was getting confused with the consecutive as I was thinking of sorting it in such a way that they would be consecutive. Your way works no matter what!

+ 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. Highlighting duplicates
    By nick2price in forum Excel General
    Replies: 10
    Last Post: 08-30-2014, 10:15 AM
  2. Highlighting consecutive cells based on values
    By thelegazy in forum Excel General
    Replies: 2
    Last Post: 07-22-2013, 05:24 PM
  3. Replies: 6
    Last Post: 02-16-2013, 07:29 AM
  4. [SOLVED] highlighting consecutive duplicates
    By coco1985 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-10-2012, 07:24 PM
  5. [SOLVED] highlighting duplicates
    By alex in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-01-2006, 01:45 PM
  6. [SOLVED] highlighting duplicates
    By Lynn in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-11-2005, 11:05 AM
  7. Help with Highlighting all duplicates in a row
    By Jimv in forum Excel General
    Replies: 4
    Last Post: 04-21-2005, 03:06 PM

Tags for this Thread

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