+ Reply to Thread
Results 1 to 9 of 9

Highlighting duplicate cells within a row

  1. #1
    Registered User
    Join Date
    08-20-2015
    Location
    London
    MS-Off Ver
    2016 for Mac
    Posts
    11

    Question Highlighting duplicate cells within a row

    I work with a spreadsheet that has hundreds of rows and numerous columns. Sometimes I accidentally duplicate the same number in more than 1 cell in a row. I know how to use conditional Formatting to highlight duplicates across a range of columns, but need to just highlight the duplicates in a row (for all the rows). E.G:

    Row 1: 03,45,22,50,45,60
    Row 2: 55,12,08,55
    Etc...

    As you can see, in Row 1, I've got the number '45' in twice, so would like to highlight this row as having a duplicate. The same for row 2 with the number '55'.

    I usually have around 800 rows and 20 columns, so doing each row individually isn't an option. I'm sure there must be a way.
    Thanks for your help!

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Highlighting duplicate cells within a row

    20 columns, so I assume columns A:T, adjust the formula if to reflect your data.
    Select the entire table
    Use Conditional Formatting
    Use a formula to determine...

    =COUNTIF($A1:$T1,A1)>1
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Valued Forum Contributor
    Join Date
    02-04-2009
    Location
    Texas
    MS-Off Ver
    Excel 2016
    Posts
    665

    Re: Highlighting duplicate cells within a row

    That is what (basically) I was trying - but that will return the highlight if there is a duplicate in the WHOLE range not just the ROW
    So - in the example if there was one 45 on row 2 it will get highlighted

  4. #4
    Registered User
    Join Date
    08-20-2015
    Location
    London
    MS-Off Ver
    2016 for Mac
    Posts
    11

    Re: Highlighting duplicate cells within a row

    Thank you so much, Special-K!!! That worked perfectly for me and just what I needed. I very much appreciate your help.

    Quote Originally Posted by Special-K View Post
    20 columns, so I assume columns A:T, adjust the formula if to reflect your data.
    Select the entire table
    Use Conditional Formatting
    Use a formula to determine...

    =COUNTIF($A1:$T1,A1)>1

  5. #5
    Registered User
    Join Date
    08-20-2015
    Location
    London
    MS-Off Ver
    2016 for Mac
    Posts
    11

    Re: Highlighting duplicate cells within a row

    Hmm, I wonder, are you selecting the columns you want to apply the formula to by the header bar (where the letters are?) It worked for me by selecting the 1st cell in the field (e.g. my data starts at cell F2) and then dragging it across to cell Y2 (where it ends), and then all the way down to the bottom of the data. You have to change the letters in the formula to reflect this change (e.g. =COUNTIF($A1:$T1,A1)>1 becomes =COUNTIF($F2:$Y2,F2)>1.
    Hope this works for you as this has really helped me :-)

  6. #6
    Valued Forum Contributor
    Join Date
    02-04-2009
    Location
    Texas
    MS-Off Ver
    Excel 2016
    Posts
    665

    Re: Highlighting duplicate cells within a row

    Nope - just saw that I had used greater than 0 ! Thus highlighting every number (but did not catch it because the way I set up my trial)
    I had used =And(A1<>"",Countif($A1:$K1,A1)>0) this accounts for blanks. But I had used only 1 & 2 numerals for the test so all of them were duplicates in the range - changing to >1 fixed it
    Once again Special K is right.

  7. #7
    Registered User
    Join Date
    08-20-2015
    Location
    London
    MS-Off Ver
    2016 for Mac
    Posts
    11

    Re: Highlighting duplicate cells within a row

    Now that this works, I would love to record a macro that does this. Every time I record it, the macro seems to ignore any of the conditional formatting I recorded. E.g, after finishing the recording, the macro only shows this:

    Sub Macro6()
    '
    ' Macro6 Macro
    '

    '
    Range("F2:Y2").Select
    Range(Selection, Selection.End(xlDown)).Select
    Range("F2").Select
    End Sub

  8. #8
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Highlighting duplicate cells within a row

    Time for someone else to get this one right, as VBA is not my forte.
    "Once again..."

  9. #9
    Registered User
    Join Date
    06-11-2020
    Location
    egypt
    MS-Off Ver
    2016
    Posts
    1

    Re: Highlighting duplicate cells within a row

    you can use Conditional Formatting tool from Styles under Home Tab
    first choose the row you need to add a condition for it
    make a new Rule
    choose Format only unique or duplicate values
    press Format
    choose Fill tab
    choose any color
    press OK
    Last edited by waelbaha; 06-25-2020 at 10:28 AM.

+ 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 Duplicate Data Using Two Cells
    By mowens74 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-03-2018, 10:21 AM
  2. [SOLVED] Highlighting Duplicate Date Using Two Cells
    By mowens74 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-03-2018, 04:50 AM
  3. Highlighting Duplicate cells?
    By Rexx372 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-20-2017, 07:09 PM
  4. Highlighting Duplicate Cells
    By vinceancona in forum Excel General
    Replies: 5
    Last Post: 09-28-2013, 02:22 PM
  5. [SOLVED] Highlighting Duplicate Cells
    By paodelol in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 02-11-2013, 11:15 AM
  6. highlighting duplicate cells
    By langdon37 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-05-2009, 05:58 AM
  7. How to Highlighting duplicate ALL cells on A:A column with red ?
    By yannipr in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-19-2008, 04:08 AM

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