index match insufficient

jkicker

Board Regular
Joined
Jun 7, 2018
Messages
79
i have a problem that i don't think index match can solve.

I have 2 sets of data, i want to use one set to look up the other set and return a value in the same row but another column. the problem is that the lookup range and the respective return results are not each in one column. For example:

lookup value
range
range
return
return
166058
880507
Name1
167885
558833
Name2
452000
554411
Name3
880507
166058
Name4
552266
Name5
452000
Name6
167885
Name7

<tbody>
</tbody>

What formula, or combination of formulas could I use so that 166058 returns Name4 AND 452000 returns Name6? Things to note: in every row of the data we are searching in, only 3 cells have data in them and there is a consistent spacing of blank cells in between. The lookup value will be the second piece of data in that row, and the return value will be the 3rd.
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Book1
ABCD
1rangerangereturnreturn
2880507Name1
3558833Name2
4554411Name3
5166058Name4
6552266Name5
7452000Name6
8167885Name7
9
10
11
12lookup value
13166058Name4
14167885Name7
15452000Name6
16880507Name1
Sheet4
Cell Formulas
RangeFormula
B13=IFNA(INDEX($C$2:$C$8,MATCH(A13,$A$2:$A$8,0)),INDEX($D$2:$D$8,MATCH(A13,$B$2:$B$8,0)))
 
Upvote 0
ABCD
1rangerangereturnreturn
2880507Name1
3558833Name2
4554411Name3
5166058Name4
6552266Name5
7452000Name6
8167885Name7
9
10
11
12lookup value
13166058Name4
14167885Name7
15452000Name6
16880507Name1

<colgroup><col style="width: 25pxpx"><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet4

Worksheet Formulas
CellFormula
B13=IFNA(INDEX($C$2:$C$8,MATCH(A13,$A$2:$A$8,0)),INDEX($D$2:$D$8,MATCH(A13,$B$2:$B$8,0)))

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
Looks good, but i should have also noted that there are more than 2 columns of range. Can i just keep adding commas to the above? Or just keep nesting IFNA? I'm gonna try both.
 
Upvote 0
So i did it, with 6 nested IFNA. Is there a better way? I just want to search a range (multiple columns) for a value and return the next non-blank value to the right.
 
Upvote 0
You could use VBA.

Code:
Sub findname()
Dim lr As Long
Dim rng As Range

lr = Cells(Rows.Count, 1).End(xlUp).Row
Set rng = Range("A2:C9")
For x = 13 To lr
    f = ""
    On Error Resume Next
    f = rng.Find(Cells(x, 1), lookat:=xlWhole).End(xlToRight)
    If f <> "" Then Cells(x, 2) = f
Next x

End Sub
 
Upvote 0
Maybe:
This is an array formula and must be entered with CTRL-SHIFT-ENTER.
Drag formula down as needed.
Excel Workbook
ABCDEFG
1lookup valuerangerangereturnreturn
2166058880507Name1Name4
3167885558833Name2Name7
4452000554411Name3Name6
5880507166058Name4Name1
6552266552266Name5Name5
7452000Name6
8167885Name7
Sheet
 
Upvote 0

Forum statistics

Threads
1,215,065
Messages
6,122,945
Members
449,095
Latest member
nmaske

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