Time in an IF formula

matt_mattuk

New Member
Joined
Aug 1, 2007
Messages
7
I have always struggled with time in Excel but this one has really beaten me.

scenario - An agent has 90 minutes to deliver our cargo to the warehouse once the aircraft has arrived on stand at the airport. Cell A1 to contain actual aircraft on stand time. Cell A2 to contain actual arrival time at warehouse. Cell A3 to contain 1 if cargo arrived late or a 0 if arrived inside the 90 minute deadline.

I was trying to work on something like =IF(A2>A1+90,1,0))

am I along the right lines at all?? :confused: :confused:
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Lewiy

Well-known Member
Joined
Jan 5, 2007
Messages
4,284
Welcome to the board! :)

Something like this maybe? It will return True for late and False for not late:

Excel Workbook
ABC
1StartEndLate?
211:0012:50TRUE
Sheet1
 

matt_mattuk

New Member
Joined
Aug 1, 2007
Messages
7
the purpose of the 1 or 0 was to enable me to total at the end but i suppose I could just use a countif to solve that. Could you give me a quick explanation on your formula pls??
 

Lewiy

Well-known Member
Joined
Jan 5, 2007
Messages
4,284
TRUE and FALSE evaluate to 1 and 0 repectively anyway so if you summed the range you would get a total equivalent to the number of late arrivals.

The formula makes use of the time function: TIME(hour,minute,second). So TIME(1,30,00) returns 1 hour 30 minutes (01:30:00). You can then add this to the time in A1 to get the latest acceptable time and then check if it is more or less than the actual arrival time in B1.

Hope that makes sense! :)
 

matt_mattuk

New Member
Joined
Aug 1, 2007
Messages
7
always shyed away from Time - i'll be more willing to give it a try now....mnay thanks!!
 

barry houdini

MrExcel MVP
Joined
Mar 23, 2005
Messages
20,825
You should be able to do a count of lateness with a single formula.

If you have aircraft arrival times in A2:A10 and corresponding arrivals at warehouse in B2:B10

=SUMPRODUCT(--(MOD(B2:B10-A2:A10,1)>"1:30"+0))

This will also accommodate aircraft arrival at times like 23:00 (if you have any of those) where the warehose arrival might be on the next day, e.g. 00:20
 

Forum statistics

Threads
1,181,053
Messages
5,927,848
Members
436,572
Latest member
khalid hussain

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
Top