# Time in an IF formula

#### matt_mattuk

##### New Member
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??

### Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
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

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??

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!

always shyed away from Time - i'll be more willing to give it a try now....mnay thanks!!

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

Replies
7
Views
491
Replies
0
Views
540
Replies
3
Views
939
Replies
6
Views
945
Replies
8
Views
1K

1,221,417
Messages
6,159,789
Members
451,589
Latest member
Harold14

### 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.

### Which adblocker are you using?

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

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