Overlapping Flight time

DrKraGeN

New Member
Joined
Jun 29, 2024
Messages
5
Office Version
  1. 365
Platform
  1. Windows
So let me explain!
DHC-6Plane Names/os/o13:0513:35
CARGOFlight NumberHugoPierreMaxim
D-8(300)Plane Names/os/o13:0514:15
CARGOFlight NumberRobertGee-CAlex M
ATR-72Plane Names/os/o13:2014:30
CARGOFlight NumberHugoPierreMaxim

In this exemple i have 3 flight Schedule in the same time range! My question is, would it be possible to have a formula that return a value in a specific cell which would say Conflicted Flight with Flight# ...... when 3 or more flight is in the same time range considering we have 2 team to serve plane at the same time
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Welcome to the forum. Are you only looking to identify the service crew conflicts? (In this case, is there only a conflict with the first and third flights?)
 
Upvote 0
Welcome to the forum. Are you only looking to identify the service crew conflicts? (In this case, is there only a conflict with the first and third flights?)
Thank you!!

In some way! i have multiple flights a day(8 to 16 flights) that required 1 team per flight, we only have 2 team and that mean that only 2 plane can be done at the same time. Usually the flights are planed taking that in consideration and are schedule that not more than 2 flights occur at the same time but some other instances there is some that are conflicted which mean that more than 2 flight are at the same time.
In the exemple they are all conflicting because there is more than 2 flight in the same time range
 
Upvote 0
Thank you!!

In some way! i have multiple flights a day(8 to 16 flights) that required 1 team per flight, we only have 2 team and that mean that only 2 plane can be done at the same time. Usually the flights are planed taking that in consideration and are schedule that not more than 2 flights occur at the same time but some other instances there is some that are conflicted which mean that more than 2 flight are at the same time.
In the exemple they are all conflicting because there is more than 2 flight in the same time range
Planification 24 au 30 juin 2024 (1).xlsx
ABCDEKLMQRSTUVXYZ
36 3HATR-72C-GWRDs/os/o14:55GPU PRIO PAX
37CARGO988616:05YGWJasonGee-CCantaveleave one guy on ATR for jet
38 3HD-8(300)C-FAIDs/os/o15:45GPU
39CARGO988717:00YGWYUDRobert Anthony Pierre
40 3HB-737(200)C-GMAI1015:40YGLAil-1Kevin 2P/76Y 1 PBM OUT 1 PBM IN
41PAX70516:45YULJasonGee-CCantaveNO BELLY ??
Mardi
Cell Formulas
RangeFormula
K36,K38K36=IFERROR(VLOOKUP(E36,'Banque de données'!A:F,5,FALSE),"")
L36,L38L36=IFERROR(VLOOKUP(E36,'Banque de données'!A:F,6,FALSE),"")
A36:A41A36=IFERROR(VLOOKUP(C36,'Banque de données'!G:H,2,FALSE),"")
B36,B38,B40B36=IFERROR(VLOOKUP(E36,'Banque de données'!A:F,3,FALSE),"")
T37,T41,T39T37=IF($AF36="","",IF($AF36="Équipe A",AI$10,IF($AF36="Équipe B",$AI$11,$AI$12)))
U37,U41,U39U37=IF($AF36="","",IF($AF36="Équipe A",$AJ$10,IF($AF36="Équipe B",$AJ$11,$AJ$12)))
V37,V41,V39V37=IF($AF36="","",IF($AF36="Équipe A",$AK$10,IF($AF36="Équipe B",$AK$11,IF($AF36="Équipe C",$AK$12,""))))
D36,D38,D40D36=IFERROR(VLOOKUP(E36,'Banque de données'!A:F,2,FALSE),"")
Y40Y40=IF(E40="C-GAIG","Escalier","")
Cells with Conditional Formatting
CellConditionCell FormatStop If True
M7,M9,M11,M13,M15,M17,M19,M21,M23,M25,M27,M29,M31,M33,M35,M37,M39,M41,M43,M45,M47Expression=$B6="HQ"textNO
M6,M8,M10,M12,M14,M16,M18,M20,M22,M24,M26,M28,M30,M32,M34,M36,M38,M40,M42,M44,M46Expression=$B6="HQ"textNO
B6:B47Cell Value="HQ"textNO
Z32:Z40Cell Valuecontains "Responsable"textNO
C6:C9,C34:C41Cell ValueduplicatestextNO
Cells with Data Validation
CellAllowCriteria
A36:A41List='Banque de données'!$L$2:$L$8
E36:E41List='Banque de données'!$A:$A



My cells reference would be M rows for the time

here a better exemple expemple!
 
Upvote 0
What i come up so far is not properly highlighting all the flight that are conflicting
Plus, when plane are already on ground they have a "-" at the arrival time and it doesnt seem to calculate properly either!

VBA Code:
Sub HighlightOverlappingFlights()
    Dim ws As Worksheet
    Dim rngArrivals As Range, rngDepartures As Range
    Dim arrivalCell As Range, departureCell As Range
    Dim overlapCount As Long
    Dim i As Long
    
    On Error Resume Next
    
    Set ws = ThisWorkbook.Sheets("Monday")
    
    If ws Is Nothing Then
        
        Exit Sub
    End If
    
    Set rngArrivals = ws.Range("M6:M46")
    Set rngDepartures = ws.Range("M7:M47")
    
    ws.Cells.FormatConditions.Delete
    
    For i = 1 To rngArrivals.Rows.Count Step 2 ' Increment of 2 for arrivals and departures
        Set arrivalCell = rngArrivals.Cells(i, 1)
        Set departureCell = rngDepartures.Cells(i, 1)
        
        If Not IsEmpty(arrivalCell.Value) And Not IsEmpty(departureCell.Value) _
           And IsNumeric(arrivalCell.Value) And IsNumeric(departureCell.Value) Then
          
            Dim adjustedArrival As Date
            If Left(arrivalCell.Value, 1) = "-" Then
                adjustedArrival = departureCell.Value - TimeValue("1:30:00")
            Else
                adjustedArrival = arrivalCell.Value
            End If
            
            overlapCount = 0
            
            ' Loop through again to compare with other flights
            For Each departureCell In rngDepartures.Cells
                If Not IsEmpty(departureCell.Value) And IsNumeric(departureCell.Value) Then
                    If departureCell.Value >= adjustedArrival And departureCell.Offset(0, -1).Value = "" Then
                        overlapCount = overlapCount + 1
                        If overlapCount >= 3 Then
                            arrivalCell.Interior.Color = RGB(255, 0, 0)
                            Exit For
                        End If
                    End If
                End If
            Next departureCell
            
        End If
    Next i
    
    On Error GoTo 0 ' Reset error handling
    
End Sub
 
Upvote 0
What i come up so far is not properly highlighting all the flight that are conflicting
Plus, when plane are already on ground they have a "-" at the arrival time and it doesnt seem to calculate properly either!

VBA Code:
Sub HighlightOverlappingFlights()
    Dim ws As Worksheet
    Dim rngArrivals As Range, rngDepartures As Range
    Dim arrivalCell As Range, departureCell As Range
    Dim overlapCount As Long
    Dim i As Long
   
    On Error Resume Next
   
    Set ws = ThisWorkbook.Sheets("Monday")
   
    If ws Is Nothing Then
       
        Exit Sub
    End If
   
    Set rngArrivals = ws.Range("M6:M46")
    Set rngDepartures = ws.Range("M7:M47")
   
    ws.Cells.FormatConditions.Delete
   
    For i = 1 To rngArrivals.Rows.Count Step 2 ' Increment of 2 for arrivals and departures
        Set arrivalCell = rngArrivals.Cells(i, 1)
        Set departureCell = rngDepartures.Cells(i, 1)
       
        If Not IsEmpty(arrivalCell.Value) And Not IsEmpty(departureCell.Value) _
           And IsNumeric(arrivalCell.Value) And IsNumeric(departureCell.Value) Then
         
            Dim adjustedArrival As Date
            If Left(arrivalCell.Value, 1) = "-" Then
                adjustedArrival = departureCell.Value - TimeValue("1:30:00")
            Else
                adjustedArrival = arrivalCell.Value
            End If
           
            overlapCount = 0
           
            ' Loop through again to compare with other flights
            For Each departureCell In rngDepartures.Cells
                If Not IsEmpty(departureCell.Value) And IsNumeric(departureCell.Value) Then
                    If departureCell.Value >= adjustedArrival And departureCell.Offset(0, -1).Value = "" Then
                        overlapCount = overlapCount + 1
                        If overlapCount >= 3 Then
                            arrivalCell.Interior.Color = RGB(255, 0, 0)
                            Exit For
                        End If
                    End If
                End If
            Next departureCell
           
        End If
    Next i
   
    On Error GoTo 0 ' Reset error handling
   
End Sub
and it doesnt apply automaticaly when i put new flight i need to run the code each time i wanna know what in overlapping
 
Upvote 0
How about:

Book1
ABCDEFGHIJKLMNOP
35Overlapping flights
36C-GWRD14:55 
37988616:059887, 705
38C-FAID15:45 
39988717:009886, 705
40C-GMAI1015:40 
4170516:459886, 9887
Sheet2
Cell Formulas
RangeFormula
O36:O41O36=IF(C36="","",LET(flights,$C$36:$C$41,times,$M$36:$M$41,start,FILTER(times,MOD(ROW(times),2)=0),end,FILTER(times,MOD(ROW(times),2)=1),flts,FILTER(flights,flights<>""),overlap,IF(M36<end,M36,end)-IF(M35>start,M35,start),TEXTJOIN(", ",1,FILTER(flts,(flts<>C36)*(overlap>0),""))))


You can set up Conditional Formatting to look for a comma in the O column, which would indicate at least 2 overlapping flights.
 
Upvote 0

Forum statistics

Threads
1,221,575
Messages
6,160,603
Members
451,657
Latest member
Ang24

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