Count duplicates across 3 columns, ignore unique (apply to entire column)

KariSaga

New Member
Joined
Apr 4, 2019
Messages
5
Hello,

I am looking for some help with a way to create a formula that looks at three columns if there are duplicates that are common across all three columns to count them, but if there are no duplicates found I do not want a count. If possible I would like to do this for the entire column without dragging the formula down as there are over 10k rows. Below is an example and formula in Column E that I have now.

=COUNTIFS(B:B,B2,C:C,C2,D:D,D2)

ABCDE
1Column1Column2Column3Column4Count
2asdfPC208saw-fra1/1/20193
3asdfPC255dfw-kkd1/5/20181
4aasdgdPC011jgg-lwc7/5/20141
5asdfadPC208saw-fra1/1/20193
6asdfadPC777omt-lis7/14/20182
7asdfPC208ohc-una1/1/20191
8asdfadPC777omt-lis7/14/20182
9asdfPC208saw-fra1/1/20193

<tbody>
</tbody>

This is what I am expecting as a result.

ABCDE
1Column1Column2Column3Column4Count
2asdfPC208saw-fra1/1/20193
3asdfPC255dfw-kkd1/5/2018
4aasdgdPC011jgg-lwc7/5/2014
5asdfadPC208saw-fra1/1/20193
6asdfadPC777omt-lis7/14/20182
7asdfPC208ohc-una1/1/2019
8asdfadPC777omt-lis7/14/20182
9asdfPC208saw-fra1/1/20193

<tbody>
</tbody>
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Well, you could use this:
Code:
=IF(COUNTIFS(B:B,B2,C:C,C2,D:D,D2)=1,"",COUNTIFS(B:B,B2,C:C,C2,D:D,D2))
Though I do not know how slow that is going to be for 10k rows.

Another option is to continue to use the formula as you have it, and use either Conditional Formatting or Custom Formatting to hide the 1's (in Conditional Formatting, just check for a value of 1 and make the color of the text white, the same as the background, so it blends in any you cannot see it).

Note that you do NOT need to drag the formula down for 10k rows. Just put the formula in row 2, and double-click on the bottom right-hand corner of the cell, and it should auto fill all the way down to the bottom of your data.
Any other automated manner would require VBA.
 
Last edited:
Upvote 0
With VBA;
Code:
Sub test()    
    With CreateObject("Scripting.Dictionary")
        son = Cells(Rows.Count, 1).End(3).Row
        For i = 2 To son
            ky = Cells(i, 2).Value & "|" & Cells(i, 3).Value & "|" & Cells(i, 2).Value & "|"
            .Item(ky) = .Item(ky) + 1
        Next i
        For i = 2 To son
            ky = Cells(i, 2).Value & "|" & Cells(i, 3).Value & "|" & Cells(i, 2).Value & "|"
            If .Item(ky) > 1 Then Cells(i, "F").Value = .Item(ky)
        Next i
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,930
Members
449,094
Latest member
teemeren

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