Index and Concatenate

How_Do_I

Well-known Member
Joined
Oct 23, 2009
Messages
1,843
Office Version
  1. 2010
Platform
  1. Windows
Using A1&B1… how would I use INDEX to return 4 in C4 please?

Excel Workbook
ABCDEFG
1FiorentinaNapoli410AS RomaCesena
223UdineseGenoa
354BariJuventus
412Chievo VeronaCatania
514AC MilanLecce
615ParmaBrescia
79SampdoriaLazio Roma
8104PalermoCagliari
94FiorentinaNapoli
107BolognaInter Milan
1145Inter MilanUdinese
123GenoaChievo Verona
132JuventusSampdoria
Sheet1


<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p>
 
H1, just enter and copy down:

=F1&"|"&G1

Now you can invoke in C1:

=INDEX($A$1:$E$13,MATCH(A1&"|"&B1,$H$1:$H$13,0))

which needs just enter.


May I ask, is there a special reason you are inserting the | character? Is it just to make sure things remain unique?
 
Upvote 0

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
May I ask, is there a special reason you are inserting the | character? Is it just to make sure things remain unique?

That would precicely be the reason. Say you have the following data and you need to concatenate the two columns in order to do a lookup.

<b>Excel 2003</b><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #A6AAB6"><colgroup><col width="25px" style="background-color: #E0E0F0" /><col /><col /></colgroup><thead><tr style=" background-color: #E0E0F0;text-align: center;color: #161120"><th></th><th>A</th><th>B</th></tr></thead><tbody><tr ><td style="color: #161120;text-align: center;">1</td><td style="text-align: right;;">11</td><td style="text-align: right;;">11</td></tr><tr ><td style="color: #161120;text-align: center;">2</td><td style="text-align: right;;">111</td><td style="text-align: right;;">1</td></tr><tr ><td style="color: #161120;text-align: center;">3</td><td style="text-align: right;;">1</td><td style="text-align: right;;">111</td></tr></tbody></table><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #A6AAB6"><thead><tr style="background-color: #E0E0F0;text-align: center;color: #161120"><th><b>Sheet1</b></th></tr></td></thead></table><br /><br />

If you straight up did a concatenation, each would would return 1111:

<b>Excel 2003</b><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #A6AAB6"><colgroup><col width="25px" style="background-color: #E0E0F0" /><col /><col /><col /></colgroup><thead><tr style=" background-color: #E0E0F0;text-align: center;color: #161120"><th></th><th>A</th><th>B</th><th>C</th></tr></thead><tbody><tr ><td style="color: #161120;text-align: center;">1</td><td style="text-align: right;;">11</td><td style="text-align: right;;">11</td><td style="text-align: right;;">1111</td></tr><tr ><td style="color: #161120;text-align: center;">2</td><td style="text-align: right;;">111</td><td style="text-align: right;;">1</td><td style="text-align: right;;">1111</td></tr><tr ><td style="color: #161120;text-align: center;">3</td><td style="text-align: right;;">1</td><td style="text-align: right;;">111</td><td style="text-align: right;;">1111</td></tr></tbody></table><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #A6AAB6"><thead><tr style="background-color: #E0E0F0;text-align: center;color: #161120"><th><b>Sheet1</b></th></tr></td></thead></table><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: #FFFFFF" ><tr><td style="padding:6px" ><b>Worksheet Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: #FFFFFF;border-collapse: collapse; border-color: #A6AAB6"><thead><tr style=" background-color: #E0E0F0;color: #161120"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: #E0E0F0;color: #161120">C1</th><td style="text-align:left">=A1&B1</td></tr></tbody></table></td></tr></table><br />

However, to keep them unique, you can split the values with any special character:

<b>Excel 2003</b><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #A6AAB6"><colgroup><col width="25px" style="background-color: #E0E0F0" /><col /><col /><col /></colgroup><thead><tr style=" background-color: #E0E0F0;text-align: center;color: #161120"><th></th><th>A</th><th>B</th><th>C</th></tr></thead><tbody><tr ><td style="color: #161120;text-align: center;">1</td><td style="text-align: right;;">11</td><td style="text-align: right;;">11</td><td style=";">11|11</td></tr><tr ><td style="color: #161120;text-align: center;">2</td><td style="text-align: right;;">111</td><td style="text-align: right;;">1</td><td style=";">111|1</td></tr><tr ><td style="color: #161120;text-align: center;">3</td><td style="text-align: right;;">1</td><td style="text-align: right;;">111</td><td style=";">1|111</td></tr></tbody></table><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #A6AAB6"><thead><tr style="background-color: #E0E0F0;text-align: center;color: #161120"><th><b>Sheet1</b></th></tr></td></thead></table><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: #FFFFFF" ><tr><td style="padding:6px" ><b>Worksheet Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: #FFFFFF;border-collapse: collapse; border-color: #A6AAB6"><thead><tr style=" background-color: #E0E0F0;color: #161120"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: #E0E0F0;color: #161120">C1</th><td style="text-align:left">=A1&"|"&B1</td></tr></tbody></table></td></tr></table><br />
 
Upvote 0
May I ask, is there a special reason you are inserting the | character? Is it just to make sure things remain unique?

Never take the risk, even if slim...

A1: 1
B1: 12
A2: 11
B2: 2

=A1&B1 ==> 112
=A2&B2 ==> 112

=A1&"|"&B1 ==> 1|12
=A2&"|"&B2 ==> 11|2
 
Upvote 0
Hi all,
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p>
What about this scenario…is there a way to get the 4 in E1 without using an array formula please?

Excel Workbook
ABCDE
1Lokomotiv MoscowDinamo MoscowTerek Grozny|Zenit St Petersburg4
2Spartak NalchikPFK Samara Kryliya
3Anzhi MakhachkalaKrasnodar
4Terek GroznyZenit St Petersburg
5Kuban KrasnodarFK Rubin Kazan
6CSKA MoscowFK Amkar Perm'
7VolgaFK Tom' Tomsk
8FK Rostov-Na-DonuSpartak Moscow
Sheet1
 
Upvote 0
Hello, try

=MATCH(D1,INDEX(A1:A8&"|"&B1:B8,),0)

This is still an array formula, but it would avoid three key combination Ctrl+Shift+Enter. Just Enter is enough.
 
Upvote 0
Hello, try

=MATCH(D1,INDEX(A1:A8&"|"&B1:B8,),0)

This is still an array formula, but it would avoid three key combination Ctrl+Shift+Enter. Just Enter is enough.

Thanks a lot for that... it works, so I'm happy... :)
 
Upvote 0

Forum statistics

Threads
1,224,592
Messages
6,179,789
Members
452,942
Latest member
VijayNewtoExcel

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