INDEX MATCH TWO COLUMNS

tezza

Active Member
Joined
Sep 10, 2006
Messages
384
Office Version
  1. 2016
  2. 2010
Platform
  1. Windows
  2. Web
Hi all,

Take a look at these two examples:

Staff Record Work Phones to be updated 2023.xlsx
NOP
1
2CTC#IMEI 1IMEI 2
3350073855391309350073855391317
4350073855387307350073855387315
5350073855387125350073855387133
6353956849674888355913289674884
7350073855387000350073855387018
8350073855385384350073855385392
9350073855384080350073855384098
10350073855387927350073855387935
11350073855388149350073855388156
Phone List
Cells with Conditional Formatting
CellConditionCell FormatStop If True
O3:O146Expression=B3<>""textNO
Cells with Data Validation
CellAllowCriteria
O3:P11Text length=15


Staff Record Work Phones to be updated 2023.xlsx
AB
1Device nameIMEI
5CTC 001350073855387000
6CTC 002350073855387307
7CTC 003350073855390582
8CTC 004350073855387125
9CTC 004350073855388792
10CTC 005350073855390228
11CTC 007350073855396761
12CTC 008350073855397389
13CTC 009350073855391309
14CTC 010350073855385392
15CTC 011350073855397363
16CTC 012350073855386960
17CTC 013350073855391135
18CTC 014350073855393149
19CTC 015350073855383405
20CTC 016350073855391556
21CTC 017350073855391663
22CTC 018350073855388958
Worksheet


I'm trying to use the INDEX MATCH functions or check where the numbers in the first sheet Col O or Col P exists in the second table Col B and return Col A, but because of the second check in Col P, I simply can't get it to work.

A typical expected result would be:

CTC 001350073855387000350073855387018


As it found 350073855387000 from the top sheet in the bottom sheet at CTC 001 in Col A.

It doesn't have to be INDEX/MATCH to achieve the result, it's just where my head was logically going.

Can you help please?
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Hi

Try: In cell N3: =IFERROR(INDEX($B$5:$C$22,MATCH(O3,$C$5:$C$22,0),1),"")&" "&IFERROR(INDEX($B$5:$C$22,MATCH(P3,$C$5:$C$22,0),1),"")
and copy down
 
Upvote 0
Solution
Hi

Try: In cell N3: =IFERROR(INDEX($B$5:$C$22,MATCH(O3,$C$5:$C$22,0),1),"")&" "&IFERROR(INDEX($B$5:$C$22,MATCH(P3,$C$5:$C$22,0),1),"")
and copy down
You are a legend, thank you.
 
Upvote 0
You are a legend, thank you.
:huh: Are you sure that is what you want?
For every row where a device name is found that formula will have a space character after or before the device name in the result cell. If no device name is found it will put a space character rather than a null string ("") as the result.
Each of those issues could easily be remedied by wrapping the formula in a TRIM function
Excel Formula:
=TRIM(IFERROR(INDEX($B$5:$C$22,MATCH(O3,$C$5:$C$22,0),1),"")&" "&IFERROR(INDEX($B$5:$C$22,MATCH(P3,$C$5:$C$22,0),1),""))

or you could just use this shorter option
Excel Formula:
=IFERROR(INDEX(B$5:B$22,IFNA(MATCH(O3,C$5:C$22,0),MATCH(P3,C$5:C$22,0))),"")
 
Upvote 0
:unsure: Are you sure that is what you want?
For every row where a device name is found that formula will have a space character after or before the device name in the result cell. If no device name is found it will put a space character rather than a null string ("") as the result.
Each of those issues could easily be remedied by wrapping the formula in a TRIM function
Excel Formula:
=TRIM(IFERROR(INDEX($B$5:$C$22,MATCH(O3,$C$5:$C$22,0),1),"")&" "&IFERROR(INDEX($B$5:$C$22,MATCH(P3,$C$5:$C$22,0),1),""))

or you could just use this shorter option
Excel Formula:
=IFERROR(INDEX(B$5:B$22,IFNA(MATCH(O3,C$5:C$22,0),MATCH(P3,C$5:C$22,0))),"")
I think I've modified it to my updated sheet but I'm getting blank cells now.

Excel Formula:
=IFERROR(INDEX(B$5:B$22,IFNA(MATCH(O3,C$5:C$22,0),MATCH(P3,C$5:C$22,0))),"")

Excel Formula:
=IFERROR(INDEX(Worksheet!$B$2:$C$110,IFNA(MATCH(P3,Worksheet!$C$2:$C$110,0),MATCH(Q3,Worksheet!$C$2:$C$110,0))),"")
 
Upvote 0
I'm wondering if you have changed your column layout since post #1? Based on the layout in that first post I think this is what you would need.

tezza.xlsm
AB
1Device nameIMEI
5CTC 001350073855387000
6CTC 002350073855387307
7CTC 003350073855390582
8CTC 004350073855387125
9CTC 004350073855388792
10CTC 005350073855390228
11CTC 007350073855396761
12CTC 008350073855397389
13CTC 009350073855391309
14CTC 010350073855385392
15CTC 011350073855397363
16CTC 012350073855386960
17CTC 013350073855391135
18CTC 014350073855393149
19CTC 015350073855383405
20CTC 016350073855391556
21CTC 017350073855391663
22CTC 018350073855388958
Worksheet


tezza.xlsm
NOP
1
2CTC#IMEI 1IMEI 2
3CTC 009350073855391309350073855391317
4CTC 002350073855387307350073855387315
5CTC 004350073855387125350073855387133
6 353956849674888355913289674884
7CTC 001350073855387000350073855387018
8CTC 010350073855385384350073855385392
9 350073855384080350073855384098
10 350073855387927350073855387935
11 350073855388149350073855388156
Phone List
Cell Formulas
RangeFormula
N3:N11N3=IFERROR(INDEX(Worksheet!$A$2:$A$110,IFNA(MATCH(P3,Worksheet!$B$2:$B$110,0),MATCH(O3,Worksheet!$B$2:$B$110,0))),"")
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,151
Members
453,021
Latest member
Justyna P

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