Finding duplicates within 5 seconds

Leo55

New Member
Joined
Aug 10, 2022
Messages
18
Office Version
  1. 2010
Platform
  1. Windows
I am unsure if this can be done,
I have searched around and nothing quite his the mark.

What I am trying to do is write something that looks at the date and time columns and if they are within 5 seconds of each other will look at two other columns within the data and if they are the same numbers are the same will delete(or highlight) the duplicate row and leave one.


Thank you in advance
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Is this even possible via function or VBA? Even if it could just highlight the duplicates within the 5 seconds would be useful.

Thanks in advance
 
Upvote 0
I think it would be necessary to see how your data is structured.
Can you show an example of your data and your expected result (just be sure to remove any sensitive data first)?

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.

Also, is your data already sorted by date/time?
If not, can it be re-sorted?
 
Upvote 0
I think it would be necessary to see how your data is structured.
Can you show an example of your data and your expected result (just be sure to remove any sensitive data first)?

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.

Also, is your data already sorted by date/time?
If not, can it be re-sorted?
Hello, thank you for the reply,

Yes the data is sorted by date and time (one column for each).
below is some dummy data to give you an idea of the data layout.

If it is possible I would like to be able to get it to search the date and time, if there are calls occurring within 5 seconds of each other, for it to check Columns E and F, if the callers (staff and customer) are the same, then to highlight or that are within that time window a colour (don't mind colour, green or red maybe?).

thank you in advance.

Book1
ABCDEF
1DateTimeDurationMethodStaff NumberCustomer Number
201/01/202012:33:250Phone12345678977849265
301/01/202012:33:270Phone12345678977849265
403/03/202015:45:5555Phone224865971892675
504/03/202009:22:2036Phone157985648132158
604/03/202009:22:2036Phone157985648132158
704/03/202009:22:2236Phone157985648132158
805/03/202016:56:3359Phone18545185126105
Sheet1
 
Upvote 0
I would use Conditional Formatting to do this.

If you select the range A1:F8, go to Conditional Formatting, select the "Use a formula to determine which cells to format" option and enter this formula:
Excel Formula:
=OR(AND($E2=$E1,$F2=$F1,ROUND(IFERROR(($A2+$B2-$A1-$B1),99),9)<=ROUND(5/86400,9)),AND($E2=$E2,$F2=$F3,ROUND(IFERROR(($A2+$B2-$A3-$B3),99),9)<=ROUND(5/86400,9)))
and then choose any highlighting color you want, it should highlight the rows where columns E and F are the same and the date/time values are within 5 seconds of each other.

So on your sample data, it would look something like this:
1662124087345.png
 
Upvote 0
Solution
I would use Conditional Formatting to do this.

If you select the range A1:F8, go to Conditional Formatting, select the "Use a formula to determine which cells to format" option and enter this formula:
Excel Formula:
=OR(AND($E2=$E1,$F2=$F1,ROUND(IFERROR(($A2+$B2-$A1-$B1),99),9)<=ROUND(5/86400,9)),AND($E2=$E2,$F2=$F3,ROUND(IFERROR(($A2+$B2-$A3-$B3),99),9)<=ROUND(5/86400,9)))
and then choose any highlighting color you want, it should highlight the rows where columns E and F are the same and the date/time values are within 5 seconds of each other.

So on your sample data, it would look something like this:
View attachment 73093
That seems to have done the trick, thank you for that!
 
Upvote 0
You are welcome!
Glad I was able to help.
 
Upvote 0

Forum statistics

Threads
1,223,892
Messages
6,175,236
Members
452,621
Latest member
Laura_PinksBTHFT

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