Help!!! Return Closest Match associated with duplicate IDs compared against start time for each day.

jesnyc

New Member
Joined
Jun 10, 2010
Messages
4
The changes our building access system and I am trying to build a work around. Our overnight staff swipe in and out of the floor throughout their shift so there are multiple timestamps for each day. I am trying to find the swipe that closest matches their shift time to find late arrivals.

I am trying to get Excel to search the uniqeIDs (combination of ID and day of the year) and find the time stamps closest to their shift start.

I have two pieces of the puzzle, but can't for the life of me figure out how to put them together.
I found a formula that looks up two criteria to return a single value and a formula that finds closest match, but can't make the mesh.

TWO CRITERIA
Code:
=INDEX(C2:C7,MATCH($C$22,IF(B2:B7="Fabres, Shelley",A2:A7),0))

CLOSEST MATCH
Code:
=INDEX(C2:C10, MATCH(MIN(ABS(C2:C10-$C$19)), ABS(C2:C10-$C$19), 0))

Any ideas on how to replace the IF statement in the first formula with the closest match formula?
Is there a simpler way to do this?


The whole data set has bout 5,000 rows and can have 10 -20 swipes in a day.
Thanks for all your help. This forum is amazing.
I hope the MRHTML table looks okay.


Excel 2010
ABCDE
1IDandDateNAMESwipeSHIFT STARTClosest Match
2WHK_8845_42219Fabres, Shelley8/3/15 5:47 AM8/3/15 5:45 AM
3WHK_8845_42219Fabres, Shelley8/3/15 12:41 PM8/3/15 5:45 AM
4WHK_8845_42219Fabres, Shelley8/3/15 2:29 PM8/3/15 5:45 AM
5WHK_8845_42220Fabres, Shelley8/4/15 5:42 AM8/4/15 5:40 AM
6WHK_8845_42220Fabres, Shelley8/4/15 11:42 AM8/4/15 5:40 AM
7WHK_8845_42220Fabres, Shelley8/4/15 2:25 PM8/4/15 5:40 AM
8WHK_8845_42221Fabres, Shelley8/5/15 5:49 AM8/5/15 6:00 AM
9WHK_8845_42221Fabres, Shelley8/5/15 2:44 PM8/5/15 6:00 AM
10WHK_8845_42222Fabres, Shelley8/6/15 5:42 AM8/6/15 5:40 AM
11WHK_8845_42222Fabres, Shelley8/6/15 2:27 PM8/6/15 5:40 AM
12WHK_8845_42227Fabres, Shelley8/11/15 5:47 AM8/11/15 5:45 AM
13WHK_8845_42227Fabres, Shelley8/11/15 9:33 AM8/11/15 5:45 AM
14WHK_8845_42227Fabres, Shelley8/11/15 2:33 PM8/11/15 5:45 AM
15WHK_8845_42228Fabres, Shelley8/12/15 5:44 AM8/12/15 5:45 AM
16WHK_8845_42228Fabres, Shelley8/12/15 2:25 PM8/12/15 5:45 AM
Sheet1
 
Last edited:

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
And, the names change since there are multiple users.

The table actually would look more like this.

Excel 2010
ABCDE
1IDandDateNAMESwipeSHIFT STARTClosest Match
2WHK_8845_42219Fabres, Shelley8/3/15 5:47 AM8/3/15 5:45 AM
3WHK_8845_42219Fabres, Shelley8/3/15 12:41 PM8/3/15 5:45 AM
4WHK_8845_42219Fabres, Shelley8/3/15 2:29 PM8/3/15 5:45 AM
5WHK_8845_42220Fabres, Shelley8/4/15 5:42 AM8/4/15 5:40 AM
6WHK_8845_42220Fabres, Shelley8/4/15 11:42 AM8/4/15 5:40 AM
7WHK_8845_42220Fabres, Shelley8/4/15 2:25 PM8/4/15 5:40 AM
8WHK_8845_42221Fabres, Shelley8/5/15 5:49 AM8/5/15 6:00 AM
9WHK_8845_42221Fabres, Shelley8/5/15 2:44 PM8/5/15 6:00 AM
10WHK_8845_42222Fabres, Shelley8/6/15 5:42 AM8/6/15 5:40 AM
11WHK_8845_42222Fabres, Shelley8/6/15 2:27 PM8/6/15 5:40 AM
12WHK_8771_42227Houston, John8/11/15 5:47 AM8/11/15 5:45 AM
13WHK_8771_42227Houston, John8/11/15 9:33 AM8/11/15 5:45 AM
14WHK_8771_42227Houston, John8/11/15 2:33 PM8/11/15 5:45 AM
15WHK_8771_42228Houston, John8/12/15 5:44 AM8/12/15 5:45 AM
16WHK_8771_42228Houston, John8/12/15 2:25 PM8/12/15 5:45 AM
Sheet1
 
Upvote 0

Forum statistics

Threads
1,215,635
Messages
6,125,940
Members
449,275
Latest member
jacob_mcbride

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