Lookup & Concatenate subheading with details

MurdochQuill

Board Regular
Joined
Nov 21, 2020
Messages
84
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I have a large sheet already with many orders, and many variations on planet types inside as a table to look up. If I were to add the planet type next to the original data, it would have to match the "ORDER CODE". Here is an example of the lookup table on Sheet 2 to get the resulting Order/Type

Book1
ABCDEFGHIJKL
1ORDER CODE 1ORDER 1ORDER CODE 2ORDER 2ORDER CODE 3ORDER 3ORDER CODE 4ORDER 4ORDER CODE 5ORDER 5ORDER CODE 6 ORDER 6
2
3XXXTTerrestrial 1EEEGDesert 2OOO4Rock 45JHH7Gas 354LKKK56Chthonian 54NBV2ICE546
4XXXETerrestrial 32EEEQDesert 3OOO5Rock 46JHH8Gas 355LKKK57Chthonian 55NBV3ICE547
5XXXFTerrestrial 33EEEHDesert 4OOO6Rock 47JHH9Gas 356LKKK58Chthonian 56NBV4ICE548
6XXXFTerrestrial 34EEE2Desert 5OOO7Rock 48JHH10Gas 357LKKK59Chthonian 57NBV5ICE549
7EEE6Desert 6OOO8Rock 49JHH11Gas 358LKKK60Chthonian 58NBV6ICE550
8EEE8Desert 7OOO9Rock 50JHH12Gas 359
9EEE1Desert 8OOO10Rock 51JHH13Gas 360
10EEE7Desert 9OOO11Rock 52
11OOO12Rock 53
12OOO13Rock 54
13
14
15
Sheet2



Col C can be added to the original data as an identifier, as my raw data output includes this code on each row which is handy.

Col E (in blue) is where I would like to do a lookup on the code table and Xlookup/Vlookup/match the ORDER name to the ORDER CODE (whichever is fastest I guess). This is the part I'm unsure how to work the formula on, and any help with the formula to get the type name would be excellent.


Book1
BCDEFGHIJ
1INPUT DATA
2IDORDER DATADataTypeORDER 1ORDER 2ORDER 3ORDER 4
3Earth467XXXF3425ORDER 1) Terrestrial 33YESNONONO
4Mars547EEEG456ORDER 2) Desert 2NOYESNONO
5Jupiter675JHH7325ORDER 4) Gas 354NONONOYES
6Jupiter567JHH9245326ORDER 4) Gas 356NONONOYES
7Mars678EEEH567ORDER 2) Desert 4NOYESNONO
8MercuryOOO44363415ORDER 3) Rock 45NONOYESNO
9PlutoOOO536456ORDER 3) Rock 46NONOYESNO
10PlutoOOO65464652ORDER 3) Rock 47NONOYESNO
11EarthXXXE3456345ORDER 1) Terrestrial 32YESNONONO
12MarsEEE7345643ORDER 2) Desert 9NOYESNONO
Sheet1
Cell Formulas
RangeFormula
G3:G12G3=IF(SUM((Sheet2!$A$3:$A$15<>"")*(ISNUMBER(MATCH("*"&Sheet2!$A$3:$A$15&"*",$C3,0)))), "YES", "NO")
H3:H12H3=IF(SUM((Sheet2!$C$3:$C$15<>"")*(ISNUMBER(MATCH("*"&Sheet2!$C$3:$C$15&"*",$C3,0)))), "YES", "NO")
I3:I12I3=IF(SUM((Sheet2!$E$3:$E$15<>"")*(ISNUMBER(MATCH("*"&Sheet2!$E$3:$E$15&"*",$C3,0)))), "YES", "NO")
J3:J12J3=IF(SUM((Sheet2!$G$3:$G$15<>"")*(ISNUMBER(MATCH("*"&Sheet2!$G$3:$G$15&"*",$C3,0)))), "YES", "NO")


Any help would be great!
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Noting that there are 2 correct results for the first row (Terrestrial33 and Terrestrial34) how do you determine that Terrestrial33 is the correct result, should it always be the first one or is there an error in the example?
 
Upvote 0
Noting that there are 2 correct results for the first row (Terrestrial33 and Terrestrial34) how do you determine that Terrestrial33 is the correct result, should it always be the first one or is there an error in the example?
Order code on Sheet 2 is unique and has the name to the right.

So we will match the ORDER DATA col on sheet 1 with it, but there are many Ranges on sheet 2.
 
Upvote 0
Order code on Sheet 2 is unique and has the name to the right.
XXXF was duplicated in the example which was why I checked first. This works with the example but it is a bit clunky, someone else may be able to shorten it a bit. If you don't have the LET function yet then it will make it longer as some sections will need to be duplicated.

MurdochQuill.xlsx
ABCDEFGHIJ
1INPUT DATA
2IDORDER DATADataTypeORDER 1ORDER 2ORDER 3ORDER 4
3Earth467XXXF3425ORDER 1) Terrestrial 33YESNONONO
4Mars547EEEG456ORDER 2) Desert 2NOYESNONO
5Jupiter675JHH7325ORDER 4) Gas 354NONONOYES
6Jupiter567JHH9245326ORDER 4) Gas 356NONONOYES
7Mars678EEEH567ORDER 2) Desert 4NOYESNONO
8MercuryOOO44363415ORDER 3) Rock 45NONOYESNO
9PlutoOOO536456ORDER 3) Rock 46NONOYESNO
10PlutoOOO65464652ORDER 3) Rock 47NONOYESNO
11EarthXXXE3456345ORDER 1) Terrestrial 32YESNONONO
12MarsEEE7345643ORDER 2) Desert 9NOYESNONO
Sheet1
Cell Formulas
RangeFormula
G3:G12G3=IF(SUM((Sheet2!$A$3:$A$15<>"")*(ISNUMBER(MATCH("*"&Sheet2!$A$3:$A$15&"*",$C3,0)))), "YES", "NO")
H3:H12H3=IF(SUM((Sheet2!$C$3:$C$15<>"")*(ISNUMBER(MATCH("*"&Sheet2!$C$3:$C$15&"*",$C3,0)))), "YES", "NO")
I3:I12I3=IF(SUM((Sheet2!$E$3:$E$15<>"")*(ISNUMBER(MATCH("*"&Sheet2!$E$3:$E$15&"*",$C3,0)))), "YES", "NO")
J3:J12J3=IF(SUM((Sheet2!$G$3:$G$15<>"")*(ISNUMBER(MATCH("*"&Sheet2!$G$3:$G$15&"*",$C3,0)))), "YES", "NO")
E3:E12E3=LET(ord,CONCAT(IF(G3:J3="Yes",$G$2:$J$2,"")),col,MATCH(SUBSTITUTE(ord," "," CODE "),Sheet2!$A$1:$L$1,0),data,INDEX(Sheet2!$A$3:$L$12,0,col)&"",ord&") "&LOOKUP(2,1/ISNUMBER(SEARCH(data,C3))/(data<>""),INDEX(Sheet2!$A$3:$L$12,0,col+1)))
 
Upvote 0
Solution
XXXF was duplicated in the example which was why I checked first. This works with the example but it is a bit clunky, someone else may be able to shorten it a bit. If you don't have the LET function yet then it will make it longer as some sections will need to be duplicated.

MurdochQuill.xlsx
ABCDEFGHIJ
1INPUT DATA
2IDORDER DATADataTypeORDER 1ORDER 2ORDER 3ORDER 4
3Earth467XXXF3425ORDER 1) Terrestrial 33YESNONONO
4Mars547EEEG456ORDER 2) Desert 2NOYESNONO
5Jupiter675JHH7325ORDER 4) Gas 354NONONOYES
6Jupiter567JHH9245326ORDER 4) Gas 356NONONOYES
7Mars678EEEH567ORDER 2) Desert 4NOYESNONO
8MercuryOOO44363415ORDER 3) Rock 45NONOYESNO
9PlutoOOO536456ORDER 3) Rock 46NONOYESNO
10PlutoOOO65464652ORDER 3) Rock 47NONOYESNO
11EarthXXXE3456345ORDER 1) Terrestrial 32YESNONONO
12MarsEEE7345643ORDER 2) Desert 9NOYESNONO
Sheet1
Cell Formulas
RangeFormula
G3:G12G3=IF(SUM((Sheet2!$A$3:$A$15<>"")*(ISNUMBER(MATCH("*"&Sheet2!$A$3:$A$15&"*",$C3,0)))), "YES", "NO")
H3:H12H3=IF(SUM((Sheet2!$C$3:$C$15<>"")*(ISNUMBER(MATCH("*"&Sheet2!$C$3:$C$15&"*",$C3,0)))), "YES", "NO")
I3:I12I3=IF(SUM((Sheet2!$E$3:$E$15<>"")*(ISNUMBER(MATCH("*"&Sheet2!$E$3:$E$15&"*",$C3,0)))), "YES", "NO")
J3:J12J3=IF(SUM((Sheet2!$G$3:$G$15<>"")*(ISNUMBER(MATCH("*"&Sheet2!$G$3:$G$15&"*",$C3,0)))), "YES", "NO")
E3:E12E3=LET(ord,CONCAT(IF(G3:J3="Yes",$G$2:$J$2,"")),col,MATCH(SUBSTITUTE(ord," "," CODE "),Sheet2!$A$1:$L$1,0),data,INDEX(Sheet2!$A$3:$L$12,0,col)&"",ord&") "&LOOKUP(2,1/ISNUMBER(SEARCH(data,C3))/(data<>""),INDEX(Sheet2!$A$3:$L$12,0,col+1)))
Ah my bad, sorry! But thanks for the help :)
 
Upvote 0

Forum statistics

Threads
1,223,964
Messages
6,175,659
Members
452,666
Latest member
AllexDee

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