If you want to find out the duplicate row having multiple entries for same person & you want to find out duplicate entries, then you should not miss this article. We will provide a macro code to help you identifying the duplicate rows. In this article, we will learn how to find duplicated rows based on particular column.
Question: I have a spreadsheet with multiple time stamped entries for people. These people can clock in or out in several places at the same time. Trying to write a formula or macro (not sure which achieves the aim best in this case) that will search the data and highlight in red lines with times that overlap for a specific person. Is this possible and is it something somebody could help with please? Many thanks.
The original question can be found here
Following is the snapshot of before sheet:
Following is the snapshot of after sheet:
To get the code; we need to follow the below steps to launch Visual Basic editor screen
Sub FindOverlapTime() Dim rng As Range, cell As Range, trng As Range, tcell As Range Dim lr As Long lr = Cells(Rows.Count, "A").End(xlUp).Row Range("A2:H" & lr).Interior.ColorIndex = xlNone Set rng = Range("C2:C" & lr) For Each cell In rng If Application.CountIf(Range("C2", cell), cell.Value) > 1 Then Set trng = Range("F2:F" & cell.Row - 1) For Each tcell In trng If tcell.Offset(0, -3) = cell Then If (cell.Offset(0, 3) >= tcell And cell.Offset(0, 3) <= tcell.Offset(0, 1)) _ Or (cell.Offset(0, 4) >= tcell And cell.Offset(0, 4) <= tcell.Offset(0, 1)) Then Range("A" & cell.Row & ":H" & cell.Row).Interior.ColorIndex = 3 End If End If Next tcell End If Next cell End Sub
Conclusion: In this way, we can find duplicate values using macro code and can remove them later.
If you liked our blogs, share it with your friends on Facebook. And also you can follow us on Twitter and Facebook.
We would love to hear from you, do let us know how we can improve, complement or innovate our work and make it better for you. Write us at email@example.com
The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.