Highlight duplicate values ignoring first Occurrence value in Excel

HappyWilliam

New Member
Joined
Apr 26, 2020
Messages
9
Office Version
  1. 365
Platform
  1. Windows
Hello Everyone,

Please can someone help me figure this out. Would like a formula/vba code for my conditional Formatting to highlight duplicates within a range but ignoring first occurrences

Check ACheck BCheck CCheck DCheck ECheck FCheck GCheck H
21523814212238
41348564526570
1011564232375299
225374750596790
55.52451001151457348
9988591333394950
455.570518164120115
211405225359965

thanks in advance
 
Thanks, yes slightly you are on the right track. Some values was missed out like 115(F8) and 115(I10) 55.5,
and 56 (E5) is the first occurence. It would need a little tweak
 
Upvote 0

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Some values was missed out like 115(F8) and 115(I10) 55.5
Yes, I was missing a $ sign - see correction below.

and 56 (E5) is the first occurence
The first 56 would be in D6 if you are checking by columns as you indicated earlier.

23 05 29.xlsm
ABCDEFGHI
3Check ACheck BCheck CCheck DCheck ECheck FCheck GCheck H
421523814212238
541348564526570
61011564232375299
7225374750596790
855.52451001151457348
99988591333394950
10455.570518164120115
11211405225359965
CF
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B4:I11Expression=COUNTIF($A$4:A$11,B4)+COUNTIF(B$4:B4,B4)>1textNO
 
Upvote 0
Solution
You're welcome. Glad we could help. Thanks for the follow-up. :)
 
Upvote 0
Would like a formula/vba code
Tow VBA options
In a module
VBA Code:
Sub test2()
    Dim cel As Range
    Dim i&
    Cells(1).CurrentRegion.Interior.Color = vbWhite
    With CreateObject("scripting.dictionary")
    For i = 1 To 8
        For Each cel In Range(Cells(2, i), Cells(9, i))
            If Not .exists(cel.Value) Then
                .Add cel.Value, ""
            Else
                cel.Interior.Color = vbRed
            End If
        Next: Next
    End With
End Sub
Worksheet code
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim cel As Range
    Dim i&
    If Not Intersect(Target, Cells(1).CurrentRegion) Is Nothing Then
    Cells(1).CurrentRegion.Interior.Color = vbWhite
    With CreateObject("scripting.dictionary")
        For i = 1 To 8
            For Each cel In Range(Cells(2, i), Cells(9, i))
                If Not .exists(cel.Value) Then
                    .Add cel.Value, ""
                Else
                    cel.Interior.Color = vbRed
                End If
            Next: Next
    End With
    End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,708
Messages
6,174,006
Members
452,542
Latest member
Bricklin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top