.XLSX Gurus please....
 

MegaSack DRAW - This year's winner is user - rgwb
We will be in touch

[Closed] .XLSX Gurus please. Time identification formula

10 Posts
5 Users
0 Reactions
109 Views
 benz
Posts: 1143
Free Member
Topic starter
 

Guru's, help please.

I am trying to understand if a start and finish time includes a working period.

The context is that trucks arrive at a distribution centre on a specific date and time and leave on a specific date and time. This is evidenced on a log, which has arrival and departure columns in format dd/mm/yyyy hh:mm.

However, the trucks can only be worked between the hours of 0700hrs and 1600hrs.

Simply, what I am trying to do is understand whether the trucks arrived within that period.

Any thoughts?

Thanks!


 
Posted : 18/02/2020 10:12 am
Posts: 23296
Free Member
 

Split the arrival time into a date & a time column and then:

=AND(A1>TIME(7,0,0),A1<TIME(16,0,0))


 
Posted : 18/02/2020 10:23 am
Posts: 0
Free Member
 

=IF(AND(HOUR(A1)>=7,HOUR(A1)<16),"YES","NO")

where A1 is the cell containing your datetime


 
Posted : 18/02/2020 10:25 am
Posts: 23296
Free Member
 

^^

better than mine..


 
Posted : 18/02/2020 10:28 am
 benz
Posts: 1143
Free Member
Topic starter
 

Thanks both for your assistance.

Unfortunately, for some reason, the formula is not returning the expected result

Cell A1 contains:

02/01/2020 12:16:00

In custom format dd/mm/yyyy hh:mm

But, when I input the formula from ebygomm in cell B1, it is returning NO.

Any thoughts?


 
Posted : 18/02/2020 12:04 pm
Posts: 0
Free Member
 

The formula returns YES for me with that date

If you use =HOUR(A1) do you get 12?


 
Posted : 18/02/2020 12:26 pm
Posts: 6859
Free Member
 

ebygomm's way worked for me although there are issues copying the text from the forum. I had to retype "Yes","no" for it to work. I guess there's some hidden formatting that Excel doesn't like.

EDIT: The code tags resolve that particular issue for me. Try copying / pasting from below.

=IF(AND(HOUR(A1)>=7,HOUR(A1)<16),"Yes","No")


 
Posted : 18/02/2020 12:46 pm
 benz
Posts: 1143
Free Member
Topic starter
 

Yes, it is returning 12, but formula still returning NO.

As a workaround, I've created the start hour in another column using =HOUR(A1) and then =IF(AND(AJ3>=7, AJ3<=16), "Yes", "No").

Weird....

I'll drop you a PM....


 
Posted : 18/02/2020 12:52 pm
 benz
Posts: 1143
Free Member
Topic starter
 

My fault....I incorrectly referenced the cell within the formula. The data was in cell I3 and I referenced I1...what a 'kin Muppet!

Thanks all for your patience and assistance.

IT WORKS 🙂


 
Posted : 18/02/2020 12:57 pm
Posts: 0
Free Member
 

Only thing to bear in mind as if the time is 16:00:00 exactly this will count as outside the time period, which may not be what you want.


 
Posted : 18/02/2020 1:08 pm
Posts: 77696
Free Member
 

ebygomm’s way worked for me although there are issues copying the text from the forum. I had to retype “Yes”,”no” for it to work. I guess there’s some hidden formatting that Excel doesn’t like.

My money would be on the quote marks being some sort of Unicode chicanery rather than ASCII #34.


 
Posted : 18/02/2020 3:32 pm