Hi,
I have two tables, one with "source" data as follows:
<tbody>
</tbody>
And a second "results" table which I wish to write some formulae for to lookup the description based upon its Geology and Height
<tbody>
</tbody>The definition code is not always contained in the lookup table, but its parent code is so I am using the following formula to check if its present and remove the trailing sub category (the trailing alpha character) if it is not:
{=IFNA(VLOOKUP(B2:B13268,Source_Lookup_Table!A:M,2,FALSE),VLOOKUP(IF(ISNUMBER(-RIGHT(B2:B13268)),B2:B13268,LEFT(B2:B13268,LEN(B2:B13268)-1)),Source_Lookup_Table!A:M,2,FALSE))}
I would like to populate the "results" table columns D, E and H with the description/importance/class of the closest category.
The helper # codes need the following logic:
#ALT
Where "Source_Lookup_Table!B:B" = "#ALT " then choose between columns C (High) and D (Low) based upon Height >=50
#ALT 2
Where "Source_Lookup_Table!B:B" = "#ALT 2" then choose between columns C (High) and D (Low) based upon Height <=10
#GEO
Where "Source_Lookup_Table!B:B = "#GEO " check if "Results_Table!F:F" (Geo column) = A
If it does - Check the altitude is >=50 and lookup column F (Geo_High) or if <50 column G (Geo_Low)
If Column F (Geo) = B then check if it exists (or its non sub category) as a separate row in column H - if NA (cannot be found) then find it in Column A and then read column H which will resolve to "#ALT " and can therefore be resolved using columns C and D as above.
This is where I am at so far (although I currently have a few more columns in my sheet) - I am using index match so I can write the formulae and then just change the column number match resolves to extract the data I need:
{=IFS((M2:M13268>=50)*(G2:G13268="#ALT "),(IFNA(INDEX(Source_Lookup_Table!C:C,MATCH(E2:E13268,Source_Lookup_Table!C:C,0)),INDEX(Source_Lookup_Table!C:C,MATCH(F2:F13268,Source_Lookup_Table!C:C,0)))),(M2:M13268<50)*(G2:G13268="#ALT "),(IFNA(INDEX(Source_Lookup_Table!D:D,MATCH(E2:E13268,Source_Lookup_Table!D:D,0)),INDEX(Source_Lookup_Table!D:D,MATCH(F2:F13268,Source_Lookup_Table!D:D,0)))),(M2:M13268<=10)*(G2:G13268="#ALT 2"),IFNA(INDEX(Source_Lookup_Table!D:D,MATCH(E2:E13268,Source_Lookup_Table!D:D,0)),INDEX(Source_Lookup_Table!D:D,MATCH(F2:F13268,Source_Lookup_Table!D:D,0))),(M2:M13268>10)*(G2:G13268="#ALT 2"),IFNA(INDEX(Source_Lookup_Table!C:C,MATCH(E2:E13268,Source_Lookup_Table!C:C,0)),INDEX(Source_Lookup_Table!C:C,MATCH(F2:F13268,Source_Lookup_Table!C:C,0))),G2:G13268="#GEO ",VLOOKUP(F2:F13268,Source_Lookup_Table!A:M,5,FALSE),TRUE,G2:G13268)}
Because I have >13200 rows I am using {array formula}. but I have discovered lots of things like AND do not work so I have tried IF((A1>3)*(B1="#GEO ")) and lots of ISNUMBER statements to keep things true of false. I have managed to get somewhere with the first two bits of logic, but it has failed again when trying to implement the ""#GEO " logic.. It is also taking a very long time to calculate on my laptop, causing excel to freeze for minutes at a time so I was hoping there might be a more efficient method?
Any guidance very gratefully received.
I have two tables, one with "source" data as follows:
A | B | C | D | E | F | G | H | I | J | K |
Lookup | Helper | High | Low | Geo_Lookup | Geo_High | Geo_Low | Other | Class | Description | Important |
A1 | A1 | 11 | Apples & Oranges | N | ||||||
A2 | #ALT | 2 | Apples & Pears | N | ||||||
A2 | 55 | High Apples & Pears | Y | |||||||
A2 | 56 | Low Apples & Pears | N | |||||||
A2a | A2a | 13 | Oranges & Plums | Y | ||||||
A2c | #ALT 2 | 14 | Plums & Pears | N | ||||||
A2c | 15 | Pears & Plums High | Y | |||||||
A2c | Pears & Plums Low | Y | ||||||||
B1 | #GEO | #GEO _ALT | 1 | Apples & Pears | Y | |||||
B1 | Apples & Pears High | |||||||||
B1 | Apples & Pears Low | Y | ||||||||
B1 | GEOApples & Pears High | N | ||||||||
B1 | GEOApples & Pears Low | Y | ||||||||
B1 | OTHER Apples & Pears | N | ||||||||
B2 | B2 | 6 | Oranges & Pears | Y | ||||||
B2a | 9 | Kiwi & Lime | N | |||||||
B3 | #GEO | #GEO _ALT | #ALT | 11 | Lime | N | ||||
B3 | Lime High | Y | ||||||||
B3 | Lime Low | N | ||||||||
B3 | GEO Lime High | Y | ||||||||
B3 | Geo Lime Low | Y | ||||||||
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
<tbody>
</tbody>
And a second "results" table which I wish to write some formulae for to lookup the description based upon its Geology and Height
A | B | C | D | E | F | G | H |
Uid | Definition | Resolves_to | Description | Important | Geo | Height | Class |
G1 | A1a | A1 | A | 50 | |||
G2 | B3 | #GEO | 11 | ||||
G3 | A2a | A2a | B | 2 | |||
G4 | A2 | #ALT | A | 200 | |||
G5 | B2b | B2 | 5 | ||||
G6 | B2 | B2 | A | 36 |
<tbody>
</tbody>
{=IFNA(VLOOKUP(B2:B13268,Source_Lookup_Table!A:M,2,FALSE),VLOOKUP(IF(ISNUMBER(-RIGHT(B2:B13268)),B2:B13268,LEFT(B2:B13268,LEN(B2:B13268)-1)),Source_Lookup_Table!A:M,2,FALSE))}
I would like to populate the "results" table columns D, E and H with the description/importance/class of the closest category.
The helper # codes need the following logic:
#ALT
Where "Source_Lookup_Table!B:B" = "#ALT " then choose between columns C (High) and D (Low) based upon Height >=50
#ALT 2
Where "Source_Lookup_Table!B:B" = "#ALT 2" then choose between columns C (High) and D (Low) based upon Height <=10
#GEO
Where "Source_Lookup_Table!B:B = "#GEO " check if "Results_Table!F:F" (Geo column) = A
If it does - Check the altitude is >=50 and lookup column F (Geo_High) or if <50 column G (Geo_Low)
If Column F (Geo) = B then check if it exists (or its non sub category) as a separate row in column H - if NA (cannot be found) then find it in Column A and then read column H which will resolve to "#ALT " and can therefore be resolved using columns C and D as above.
This is where I am at so far (although I currently have a few more columns in my sheet) - I am using index match so I can write the formulae and then just change the column number match resolves to extract the data I need:
{=IFS((M2:M13268>=50)*(G2:G13268="#ALT "),(IFNA(INDEX(Source_Lookup_Table!C:C,MATCH(E2:E13268,Source_Lookup_Table!C:C,0)),INDEX(Source_Lookup_Table!C:C,MATCH(F2:F13268,Source_Lookup_Table!C:C,0)))),(M2:M13268<50)*(G2:G13268="#ALT "),(IFNA(INDEX(Source_Lookup_Table!D:D,MATCH(E2:E13268,Source_Lookup_Table!D:D,0)),INDEX(Source_Lookup_Table!D:D,MATCH(F2:F13268,Source_Lookup_Table!D:D,0)))),(M2:M13268<=10)*(G2:G13268="#ALT 2"),IFNA(INDEX(Source_Lookup_Table!D:D,MATCH(E2:E13268,Source_Lookup_Table!D:D,0)),INDEX(Source_Lookup_Table!D:D,MATCH(F2:F13268,Source_Lookup_Table!D:D,0))),(M2:M13268>10)*(G2:G13268="#ALT 2"),IFNA(INDEX(Source_Lookup_Table!C:C,MATCH(E2:E13268,Source_Lookup_Table!C:C,0)),INDEX(Source_Lookup_Table!C:C,MATCH(F2:F13268,Source_Lookup_Table!C:C,0))),G2:G13268="#GEO ",VLOOKUP(F2:F13268,Source_Lookup_Table!A:M,5,FALSE),TRUE,G2:G13268)}
Because I have >13200 rows I am using {array formula}. but I have discovered lots of things like AND do not work so I have tried IF((A1>3)*(B1="#GEO ")) and lots of ISNUMBER statements to keep things true of false. I have managed to get somewhere with the first two bits of logic, but it has failed again when trying to implement the ""#GEO " logic.. It is also taking a very long time to calculate on my laptop, causing excel to freeze for minutes at a time so I was hoping there might be a more efficient method?
Any guidance very gratefully received.