Calculating overlapping times to determine how many minutes two aircraft in one piece of airspace.

Marksma

New Member
Joined
Jan 16, 2015
Messages
18
Hello, I am using Excel 2010 and trying to develop a template that will calculate how many minutes two aircraft are in the same sector (piece of airspace). For example: ( I don't know how to upload the spreadsheet so you can see it.)

The first aircraft enters the sector at 13:45, the second aircraft enters at 13:59…the first aircraft then exits the sector at 14:05 which puts them in the same sector of airspace for 6 minutes.

So for columns I have Date, Sector #, Time enter sector for a/c #1, Time exit sector for a/c #1, Time enter sector for a/c #2, Time exit sector for a/c #2, Minutes aircraft in same sector together. I formatted the time column custom, hhmm and am entering time in 24 hour clock and manually entering the colon :.

A: Date B: Sector # C: a/c1 Time in D: a/c1 Time out E: a/c2 Time in F: a/c2 Time out G: Minutes together H: has this formula =IF(D5>E5,1,0) in order to solve the issue of getting a negative number if a/c 2 enters the sector after a/c1 is no longer there (so they are not in the same sector at the same time)

ABCDEFG =(MAX(E5,C5)-MIN(D5,F5))*H5H =IF(D5>E5,1,0)
DATESEC #TIME INTIME OUTTIME INTIME OUTMIN SAME SECTOR1 OR 0
7-2-151813:3013:5013:4513:5551
7-3-151823:5500:1023:5900:15111
7-4-151814:0514:1515:0015:1000
7-5-151814:0014:1513:2013:5010 (erroneous)1
7-6-151815:1516:0015:2515:45-0.0138888888888891

<tbody>
</tbody>

The top three are what it should come up with, the bottom two are examples of it going wrongly for me!

In Column G, I have this formula =(MAX(E5,C5)-MIN(D5,F5))*H5 (if it's a negative number it will be multiplied by 0 from column H and show 0 for no minutes in the same sector at the same time.

For those times that span the date (i.e. 11:55 p.m to 12:05 a.m. or 2350 to 0005). I sort of solved this by putting in 2405 instead of 0005). But am not sure it will always work, mostly because I don't understand why it converts it to 0005 in the cell but still recognizes that it's a bigger number to make the formula in column H work.

The formula =(MAX(E5,C5)-MIN(D5,F5))*H5 is working for some but not others.

I don't even know if I'm on the right track. There are so many variables. Anyone have any ideas how to figure out how many minutes two aircraft are in the same sector at the same time?
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
I think this might work. You need to put the dates and times in the columns C through F so that dealing with events wrapping around midnight is easy. So the entry 7/2/15 13:50 is actually 42187.5763888889 formatted as date with time.

Disclaimer: Don't blame me if the planes crash!




Date Sector A/C 1 in A/C 1 out A/C 2 in A/C 2 out Overlap (minutes)
7/2/2015 18 7/2/15 13:30 7/2/15 13:50 7/2/15 13:45 7/2/15 13:55 5.00

=(E2<=D2)*(F2>=C2)*(MIN(D2,F2)-MAX(E2,C2))*24*60


7/3/2015 18 7/3/15 23:55 7/4/15 0:10 7/3/15 23:59 7/4/15 0:15 11.00
7/4/2015 18 7/4/15 14:05 7/4/15 14:15 7/4/15 15:00 7/4/15 15:10 -
7/5/2015 18 7/5/15 14:00 7/5/15 14:15 7/5/15 13:20 7/5/15 13:50 -
7/6/2015 18 7/6/15 15:15 7/6/15 16:00 7/6/15 15:25 7/6/15 15:45 20.00
 
Last edited:
Upvote 0
Hi,

First thing, I would always use the full DateTime values for this kind of calculation. So never separate the date and the time but combine them into one cell. You can format the cells to just show the time portion but always use the full DateTime. That way times across midnight will come out correctly.

Your layout works with this formula. I used an extra MAX instead of your extra column.

Excel 2013
ABCDEF
1SEC #TIME INTIME OUTTIME INTIME OUTMIN SAME SECTOR
21802/07/2015 13:3002/07/2015 13:5002/07/2015 13:4502/07/2015 13:5500:05
31803/07/2015 23:5504/07/2015 00:1003/07/2015 23:5904/07/2015 00:1500:11
41804/07/2015 14:0504/07/2015 14:1504/07/2015 15:0004/07/2015 15:1000:00
51805/07/2015 14:0005/07/2015 14:1505/07/2015 13:2005/07/2015 13:5000:00
61806/07/2015 15:1506/07/2015 16:0006/07/2015 15:2506/07/2015 15:4500:20
Sheet1
Cell Formulas
RangeFormula
F2=MAX(MIN(C2,E2)-MAX(B2,D2),0)


It might be worth comparing each flight with every other one. That would give you a grid. You can format 00:00 as blanks by using semi-colons in the formulas. For example:
HH:MM;;

You could also use Conditional Formatting to highlight the shared sector times in a different colour.


Excel 2013
ABCDEFGH
1SEC #1818181818
2TIME IN02/07/2015 13:4503/07/2015 23:5904/07/2015 15:0005/07/2015 13:2006/07/2015 15:25
3TIME OUT02/07/2015 13:5504/07/2015 00:1504/07/2015 15:1005/07/2015 13:5006/07/2015 15:45
41802/07/2015 13:3002/07/2015 13:5000:05    
51803/07/2015 23:5504/07/2015 00:1000:11
61804/07/2015 14:0504/07/2015 14:15
71805/07/2015 14:0005/07/2015 14:15
81806/07/2015 15:1506/07/2015 16:0000:20
Sheet2
Cell Formulas
RangeFormula
D4=MAX(MIN($C4,D$3)-MAX($B4,D$2),0)
E4=MAX(MIN($C4,E$3)-MAX($B4,E$2),0)
F4=MAX(MIN($C4,F$3)-MAX($B4,F$2),0)
G4=MAX(MIN($C4,G$3)-MAX($B4,G$2),0)
H4=MAX(MIN($C4,H$3)-MAX($B4,H$2),0)
 
Upvote 0
Don't worry, these planes have already flown through so you and your formula are safe! haha

I will take a look. Thank you for your help.
 
Upvote 0
RickXL

Thanks so much, I like the different approaches to laying it out. Especially since sometimes there are THREE that we have to compare...(I'll attempt to wrap my brain around that one once I figure out two of them!)

I'm trying to understand the extra MAX.. I'm a newbie and reading/writing formulas...I get the middle part inside the parentheses, but the extra MAX and last zero are throwing me. Is it sort of "enter the MAX of either the result of the parentheses or 0, whichever is greater? Which would keep it from being a negative number?
 
Upvote 0
RickXL, It worked! Thank you so much. Hopefully I understand the use of that extra MAX and ,0 but either way, it worked like a charm.
 
Upvote 0
Good news!

The MAX works like your extra column. It is saying, if the answer is positive then go with it but if the answer is negative then set it to zero.

Regards,
 
Upvote 0

Forum statistics

Threads
1,216,028
Messages
6,128,392
Members
449,445
Latest member
JJFabEngineering

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