KungFu Keyboard
New Member
- Joined
- Oct 22, 2016
- Messages
- 26
Hi there,
I have 2 data sets:
Dataset 1 (Flight Table)
[TABLE="width: 500"]
<tbody>[TR]
[TD]Flight Number[/TD]
[TD]Date[/TD]
[TD]Day[/TD]
[TD]Departure Time[/TD]
[TD]Arrival Time[/TD]
[/TR]
[TR]
[TD]19020[/TD]
[TD]05/10/2017[/TD]
[TD]Wednesday[/TD]
[TD](formula)[/TD]
[TD](formula)[/TD]
[/TR]
</tbody>[/TABLE]
Dataset 2 (Flight Schedule)
[TABLE="width: 500"]
<tbody>[TR]
[TD]Flight number[/TD]
[TD]Start date[/TD]
[TD]End Date[/TD]
[TD]Departure Time[/TD]
[TD]Arrival Time[/TD]
[TD]Monday[/TD]
[TD]Tuesday[/TD]
[TD]Wednesday[/TD]
[TD]Thursday[/TD]
[TD]Friday[/TD]
[TD]Saturday[/TD]
[TD]Sunday[/TD]
[/TR]
[TR]
[TD]19020[/TD]
[TD]01/10/2017[/TD]
[TD]10/10/2017[/TD]
[TD]07:20[/TD]
[TD]16:00[/TD]
[TD]Monday[/TD]
[TD][/TD]
[TD]Wednesday[/TD]
[TD][/TD]
[TD]Friday[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]19020[/TD]
[TD]03/10/2018[/TD]
[TD]12/10/2017[/TD]
[TD]07:45[/TD]
[TD]16:30[/TD]
[TD][/TD]
[TD]Tuesday[/TD]
[TD][/TD]
[TD]Thursday[/TD]
[TD][/TD]
[TD]Saturday[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
I need to pull the DEPARTURE and ARRIVAL TIME from the FLIGHT SCHEDULE into the FLIGHT TABLE based on whether the DATE in the FLIGHT TABLE falls within the range between START DATE and END DATE in the FLIGHT SCHEDULE.
The above is simple to solve and the following formula was used:
INDEX('FLIGHT SCHEDULE'!$D:$D,MATCH(1,('FLIGHT SCHEDULE'!A:A=FLIGHTS!A2)*('FLIGHT SCHEDULE'!B:B<=FLIGHTS!B2)*('FLIGHT SCHEDULE'!C:C>=FLIGHTS!B2))
Confirming the actual day is a bit more challenging though as it requires a reference across the 7 columns (Monday - Sunday) in the FLIGHT SCHEDULE. I tried using a nested IF formula that references the day in the FLIGHT TABLE and does the same index match in the column for that day e.g. (The cell references below are from the actual dataset)
=IF(AB3="Monday",INDEX('FLIGHT SCHEDULE'!$F:$F,MATCH(1,('FLIGHT SCHEDULE'!A:A=FLIGHTS!B3)*('FLIGHT SCHEDULE'!B:B<=FLIGHTS!D3)*('FLIGHT SCHEDULE'!C:C>=FLIGHTS!D3)*('FLIGHT SCHEDULE'!N:N=FLIGHTS!AB3),0)),IF(AB3="Tuesday",INDEX('FLIGHT SCHEDULE'!$F:$F,MATCH(1,('FLIGHT SCHEDULE'!A:A=FLIGHTS!B3)*('FLIGHT SCHEDULE'!B:B<=FLIGHTS!D3)*('FLIGHT SCHEDULE'!C:C>=FLIGHTS!D3)*('FLIGHT SCHEDULE'!O:O=FLIGHTS!AB3),0)),IF(AB3="Wednesday",INDEX('FLIGHT SCHEDULE'!$F:$F,MATCH(1,('FLIGHT SCHEDULE'!A:A=FLIGHTS!B3)*('FLIGHT SCHEDULE'!B:B<=FLIGHTS!D3)*('FLIGHT SCHEDULE'!C:C>=FLIGHTS!D3)*('FLIGHT SCHEDULE'!P:P=FLIGHTS!AB3),0)),IF(AB3="Thursday",INDEX('FLIGHT SCHEDULE'!$F:$F,MATCH(1,('FLIGHT SCHEDULE'!A:A=FLIGHTS!B3)*('FLIGHT SCHEDULE'!B:B<=FLIGHTS!D3)*('FLIGHT SCHEDULE'!C:C>=FLIGHTS!D3)*('FLIGHT SCHEDULE'!Q:Q=FLIGHTS!AB3),0)),IF(AB3="Friday",INDEX('FLIGHT SCHEDULE'!$F:$F,MATCH(1,('FLIGHT SCHEDULE'!A:A=FLIGHTS!B3)*('FLIGHT SCHEDULE'!B:B<=FLIGHTS!D3)*('FLIGHT SCHEDULE'!C:C>=FLIGHTS!D3)*('FLIGHT SCHEDULE'!R:R=FLIGHTS!AB3),0)))))))
The problem is I can only use 5 conditions and then excel starts giving error messages. Is there a better way to do this?
Regards,
Bernard
I have 2 data sets:
Dataset 1 (Flight Table)
[TABLE="width: 500"]
<tbody>[TR]
[TD]Flight Number[/TD]
[TD]Date[/TD]
[TD]Day[/TD]
[TD]Departure Time[/TD]
[TD]Arrival Time[/TD]
[/TR]
[TR]
[TD]19020[/TD]
[TD]05/10/2017[/TD]
[TD]Wednesday[/TD]
[TD](formula)[/TD]
[TD](formula)[/TD]
[/TR]
</tbody>[/TABLE]
Dataset 2 (Flight Schedule)
[TABLE="width: 500"]
<tbody>[TR]
[TD]Flight number[/TD]
[TD]Start date[/TD]
[TD]End Date[/TD]
[TD]Departure Time[/TD]
[TD]Arrival Time[/TD]
[TD]Monday[/TD]
[TD]Tuesday[/TD]
[TD]Wednesday[/TD]
[TD]Thursday[/TD]
[TD]Friday[/TD]
[TD]Saturday[/TD]
[TD]Sunday[/TD]
[/TR]
[TR]
[TD]19020[/TD]
[TD]01/10/2017[/TD]
[TD]10/10/2017[/TD]
[TD]07:20[/TD]
[TD]16:00[/TD]
[TD]Monday[/TD]
[TD][/TD]
[TD]Wednesday[/TD]
[TD][/TD]
[TD]Friday[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]19020[/TD]
[TD]03/10/2018[/TD]
[TD]12/10/2017[/TD]
[TD]07:45[/TD]
[TD]16:30[/TD]
[TD][/TD]
[TD]Tuesday[/TD]
[TD][/TD]
[TD]Thursday[/TD]
[TD][/TD]
[TD]Saturday[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
I need to pull the DEPARTURE and ARRIVAL TIME from the FLIGHT SCHEDULE into the FLIGHT TABLE based on whether the DATE in the FLIGHT TABLE falls within the range between START DATE and END DATE in the FLIGHT SCHEDULE.
The above is simple to solve and the following formula was used:
INDEX('FLIGHT SCHEDULE'!$D:$D,MATCH(1,('FLIGHT SCHEDULE'!A:A=FLIGHTS!A2)*('FLIGHT SCHEDULE'!B:B<=FLIGHTS!B2)*('FLIGHT SCHEDULE'!C:C>=FLIGHTS!B2))
Confirming the actual day is a bit more challenging though as it requires a reference across the 7 columns (Monday - Sunday) in the FLIGHT SCHEDULE. I tried using a nested IF formula that references the day in the FLIGHT TABLE and does the same index match in the column for that day e.g. (The cell references below are from the actual dataset)
=IF(AB3="Monday",INDEX('FLIGHT SCHEDULE'!$F:$F,MATCH(1,('FLIGHT SCHEDULE'!A:A=FLIGHTS!B3)*('FLIGHT SCHEDULE'!B:B<=FLIGHTS!D3)*('FLIGHT SCHEDULE'!C:C>=FLIGHTS!D3)*('FLIGHT SCHEDULE'!N:N=FLIGHTS!AB3),0)),IF(AB3="Tuesday",INDEX('FLIGHT SCHEDULE'!$F:$F,MATCH(1,('FLIGHT SCHEDULE'!A:A=FLIGHTS!B3)*('FLIGHT SCHEDULE'!B:B<=FLIGHTS!D3)*('FLIGHT SCHEDULE'!C:C>=FLIGHTS!D3)*('FLIGHT SCHEDULE'!O:O=FLIGHTS!AB3),0)),IF(AB3="Wednesday",INDEX('FLIGHT SCHEDULE'!$F:$F,MATCH(1,('FLIGHT SCHEDULE'!A:A=FLIGHTS!B3)*('FLIGHT SCHEDULE'!B:B<=FLIGHTS!D3)*('FLIGHT SCHEDULE'!C:C>=FLIGHTS!D3)*('FLIGHT SCHEDULE'!P:P=FLIGHTS!AB3),0)),IF(AB3="Thursday",INDEX('FLIGHT SCHEDULE'!$F:$F,MATCH(1,('FLIGHT SCHEDULE'!A:A=FLIGHTS!B3)*('FLIGHT SCHEDULE'!B:B<=FLIGHTS!D3)*('FLIGHT SCHEDULE'!C:C>=FLIGHTS!D3)*('FLIGHT SCHEDULE'!Q:Q=FLIGHTS!AB3),0)),IF(AB3="Friday",INDEX('FLIGHT SCHEDULE'!$F:$F,MATCH(1,('FLIGHT SCHEDULE'!A:A=FLIGHTS!B3)*('FLIGHT SCHEDULE'!B:B<=FLIGHTS!D3)*('FLIGHT SCHEDULE'!C:C>=FLIGHTS!D3)*('FLIGHT SCHEDULE'!R:R=FLIGHTS!AB3),0)))))))
The problem is I can only use 5 conditions and then excel starts giving error messages. Is there a better way to do this?
Regards,
Bernard