Combining Date and Time

PCRIDE

Well-known Member
Joined
Jan 20, 2008
Messages
907
Hi, I am building an attendance tracker, log in time compared to scheduled. I have date and time for Scheduled time in two columns, if I combine date and time from two fields using =K6&" "&H6 and returns 45200 0.375. Its not formatting correctly.

Or I could just do something like i.e Late = L, Ontime = O

=IFERROR(IF(AND(HOUR(C6>H6),MINUTE(C6>H6)),"L","O"),"Not Found")

everything is coming up as O when it should be Late. Something is not working here.
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Hi, I am building an attendance tracker, log in time compared to scheduled. I have date and time for Scheduled time in two columns, if I combine date and time from two fields using =K6&" "&H6 and returns 45200 0.375. Its not formatting correctly.

Or I could just do something like i.e Late = L, Ontime = O

=IFERROR(IF(AND(HOUR(C6>H6),MINUTE(C6>H6)),"L","O"),"Not Found")

everything is coming up as O when it should be Late. Something is not working here.
I think I need more logic come to think of it in the second example.

Figured it out. Thanks!

=IF(AND(HOUR(C40)=HOUR(H40),MINUTE(C40)>MINUTE(H40)),"L",IF(AND(HOUR(C40)>HOUR(H40),MINUTE(C40)>MINUTE(H40)),"L","O"))
 
Last edited:
Upvote 0
To combine date and time
=K6+H6

Maybe something like this for L or O.
Book2
ABCDEFGH
610:30 AML10:15 AM
7
8DateTimecombined
91/12/202410:15 AM1/12/2024 10:15
Sheet1
Cell Formulas
RangeFormula
D6D6=IFERROR(IF(C6>H6,"L","o"),"Not Found")
E9E9=C9+D9
 
Upvote 0
Solution
To combine date and time
=K6+H6

Maybe something like this for L or O.
Book2
ABCDEFGH
610:30 AML10:15 AM
7
8DateTimecombined
91/12/202410:15 AM1/12/2024 10:15
Sheet1
Cell Formulas
RangeFormula
D6D6=IFERROR(IF(C6>H6,"L","o"),"Not Found")
E9E9=C9+D9
Ok just a basic +, I'll try that.

Can you also provide any suggestions for the logout?

If the schedule is until 6:00 PM, but the user logs out at 11:29 AM (before noon), how do I handle the logic I put above, checking minute > or < , since its the time has rolled over past noon.
So my logic won't work in this scenario because minute is not less than the scheduled minute.
 
Upvote 0
I just combined the fields, now I can just use greater and less than. Problem solved! Thanks again AhoyNC
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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