Excel Formula for Looking up Time In and Out

reighzaigne

New Member
Joined
Oct 19, 2015
Messages
28
Hi!

Our biometrics had a glitch and I have to manually check the data extracted from the machine. There are multiple logs in a day from different people. I would like to know the formula to get the First In and Last Out per person per day. I initially concatenated the employee number and dates to somewhat create a code. So now I just need to get the first and last logs.

Of if you have other ideas on how to solve it, please let me know. :)

Here's an example:
[TABLE="class: grid, width: 348"]
<colgroup><col span="2"><col><col><col></colgroup><tbody>[TR]
[TD]Concatenate [/TD]
[TD]EnNo[/TD]
[TD]DateTime[/TD]
[TD]Date[/TD]
[TD]Time[/TD]
[/TR]
[TR]
[TD]643467[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]02/01/19 8:47[/TD]
[TD="align: right"]02/01/19[/TD]
[TD="align: right"]8:47:07 AM[/TD]
[/TR]
[TR]
[TD]643467[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]02/01/19 15:42[/TD]
[TD="align: right"]02/01/19[/TD]
[TD="align: right"]3:42:31 PM[/TD]
[/TR]
[TR]
[TD]843468[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]03/01/19 4:44[/TD]
[TD="align: right"]03/01/19[/TD]
[TD="align: right"]4:44:47 AM[/TD]
[/TR]
[TR]
[TD]843468[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]03/01/19 4:44[/TD]
[TD="align: right"]03/01/19[/TD]
[TD="align: right"]4:44:47 AM[/TD]
[/TR]
[TR]
[TD]643468[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]03/01/19 8:59[/TD]
[TD="align: right"]03/01/19[/TD]
[TD="align: right"]8:59:15 AM[/TD]
[/TR]
[TR]
[TD]343468[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]03/01/19 9:29[/TD]
[TD="align: right"]03/01/19[/TD]
[TD="align: right"]9:29:31 AM[/TD]
[/TR]
[TR]
[TD]243468[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]03/01/19 10:42[/TD]
[TD="align: right"]03/01/19[/TD]
[TD="align: right"]10:42:05 AM[/TD]
[/TR]
[TR]
[TD]243468[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]03/01/19 10:42[/TD]
[TD="align: right"]03/01/19[/TD]
[TD="align: right"]10:42:05 AM[/TD]
[/TR]
[TR]
[TD]843468[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]03/01/19 13:45[/TD]
[TD="align: right"]03/01/19[/TD]
[TD="align: right"]1:45:11 PM[/TD]
[/TR]
[TR]
[TD]643468[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]03/01/19 17:00[/TD]
[TD="align: right"]03/01/19[/TD]
[TD="align: right"]5:00:30 PM[/TD]
[/TR]
[TR]
[TD]343468[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]03/01/19 17:09[/TD]
[TD="align: right"]03/01/19[/TD]
[TD="align: right"]5:09:43 PM[/TD]
[/TR]
[TR]
[TD]343468[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]03/01/19 17:09[/TD]
[TD="align: right"]03/01/19[/TD]
[TD="align: right"]5:09:43 PM[/TD]
[/TR]
[TR]
[TD]243468[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]03/01/19 19:53[/TD]
[TD="align: right"]03/01/19[/TD]
[TD="align: right"]7:53:31 PM[/TD]
[/TR]
[TR]
[TD]243468[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]03/01/19 19:53[/TD]
[TD="align: right"]03/01/19[/TD]
[TD="align: right"]7:53:31 PM[/TD]
[/TR]
[TR]
[TD]243468[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]03/01/19 21:08[/TD]
[TD="align: right"]03/01/19[/TD]
[TD="align: right"]9:08:53 PM[/TD]
[/TR]
</tbody>[/TABLE]


And then I would like to make it into something like this:
[TABLE="class: grid, width: 330"]
<colgroup><col span="2"><col><col span="2"></colgroup><tbody>[TR]
[TD][/TD]
[TD]DATE[/TD]
[TD]In[/TD]
[TD]Out[/TD]
[TD]Duration[/TD]
[/TR]
[TR]
[TD]243486[/TD]
[TD="align: right"]21/01/19[/TD]
[TD="align: right"]02:10:59 AM[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]243487[/TD]
[TD="align: right"]22/01/19[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]243488[/TD]
[TD="align: right"]23/01/19[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]243489[/TD]
[TD="align: right"]24/01/19[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]243490[/TD]
[TD="align: right"]25/01/19[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]



You can check the file here:
https://drive.google.com/open?id=1H2R5QWzsJRNop3RzsulFIajK9bqwXKDq


Thank you!
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
try


Book1
ABCDE
1Cha12:00:00 AM
2
3DATEInOutDuration
424348621/01/201902:10:59 AM11:43:34 PM21:32:35
524348722/01/201903:31:25 AM07:38:49 PM16:07:24
624348823/01/201912:35:59 PM09:41:47 PM09:05:48
724348924/01/201911:46:49 AM09:04:43 PM09:17:54
824349025/01/201902:52:30 AM08:51:55 PM17:59:25
924349126/01/201904:22:08 AM11:59:45 PM19:37:37
1024349227/01/201904:31:28 PM10:46:00 PM06:14:32
2 - Cha
Cell Formulas
RangeFormula
C4=MINIFS(Sheet1!F:F,Sheet1!B:B,A4,Sheet1!E:E,B4)
D4=MAXIFS(Sheet1!F:F,Sheet1!B:B,A4,Sheet1!E:E,B4)
E4=D4-C4
 
Upvote 0
the minif() & maxif() are not available for the older version of excel, try this


Book1
ABCDE
1Cha12:00:00 AM
2
3DATEInOutDuration
424348621/01/201902:10:59 AM11:43:34 PM21:32:35
524348722/01/201903:31:25 AM07:38:49 PM16:07:24
624348823/01/201912:35:59 PM09:41:47 PM09:05:48
724348924/01/201911:46:49 AM09:04:43 PM09:17:54
824349025/01/201902:52:30 AM08:51:55 PM17:59:25
924349126/01/201904:22:08 AM11:59:45 PM19:37:37
1024349227/01/201904:31:28 PM10:46:00 PM06:14:32
1124349328/01/201912:43:45 AM11:37:03 PM22:53:18
2 - Cha
Cell Formulas
RangeFormula
E4=D4-C4
C4{=MIN(IF(Sheet1!$B1:$B10000='2 - Cha'!A4,IF(Sheet1!$E1:$E10000='2 - Cha'!B4,Sheet1!$F1:$F10000)))}
D4{=MAX(IF(Sheet1!$B1:$B10000='2 - Cha'!A4,IF(Sheet1!$E1:$E10000='2 - Cha'!B4,Sheet1!$F1:$F10000)))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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