Conditional RELATED formula

Bilingual

Board Regular
Joined
Oct 1, 2010
Messages
186
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I have a Data table where Departure and Arrival code is in each column (Eks Column 1; LONDON2085 , Column 2; BIRMINGHAM1655)
I have a separate Lookup table where ONE code is mentioned and a type , (Eks Column 1 ; LONDON2085 , Column 2 ; "Within City perimeter"

The purpose is to use Column 2 and the type, whenever a departure and arrival code is equal to the value in Column 1, Eks (Departure : LONDON2085, Arrival ; LONDON2085 - gives value "Within City perimeter"

The problem is that RELATE looks in the whole Data table, but i need to RELATE to look up in both Departure and then Arrival code before returning from Lookup table.


I solved it somehow, I split up the Departure and Arrival codes into two identical tables: but encountered a new problem, i use the formula :


IF(AND(RELATED(Arrival_Lookuptable[Planetzone])=TRIM([Arrival_Datatable]);RELATED(Departure_Lookuptable[Planetzone])=TRIM([Departure_Datatable]));1;0) ,


But somehow it still counts empty cells as well. even though they are not listed in the Tables, what is wrong?
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Forum statistics

Threads
1,215,262
Messages
6,123,938
Members
449,134
Latest member
NickWBA

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