vLOOKUP OR INDEX

cogswel__cogs

Board Regular
Joined
Jan 3, 2018
Messages
168
I am being sent table in followoing format
I want to lookup based on name and color.
Do I use a vlookup with offset?
Index and match?

ColA COLB

John
Red 12
Blue 324
Pink 34
Paul
Green 1234
Red 1121

Any help is always greatly appreciated
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
JohnJohnJohn
JohnRed12John#Red12
JohnBlue324John#Blue324
JohnPink34John#Pink34
PaulaPaulaPaulavery easy to put in 2 helper columns
PaulaGreen1234to get the name by every rowPaula#Green1234
PaulaRed1121Paula#Red1121
then to append name plus # to color
type in nameJohn
type in colorBlue
search forJohn#Blue
quantity
324
formula
=OFFSET($K$1,MATCH($G$18,$K$2:$K$7,0),1)

<colgroup><col span="2"><col><col span="7"><col><col span="2"></colgroup><tbody>
</tbody>
 
Upvote 0
Was trying to do it without additional columns as I am going to get as a feed often,
Wound up using indirect to rewrite the table array. Not sure if it is best way but seems to be working.


VLOOKUP($D26,INDIRECT("table!A"&MATCH($C26,table!$A$1:$A$106,0)&":g106"),7,FALSE)
 
Upvote 0
I'm a bit confused but these are the assumptions I'm making. 1.) You have a column with only names in it. 2.) You have another column with colors in it. 3.) Another column with the return values. If these are all true then the code below will work, just replace the descriptions with the cells they are asking for.

IF(MATCH(CELL WHERE NAME TO LOOK UP IS LOCATED,CELL RANGE WHERE ALL NAMES ARE LOCATED,0)index(CELL RANGE WHERE THE VALUE YOU WANT TO RETURN IS LOCATED,MATCH(CELL WHERE COLOR IS LOCATED, CELL RANGE WHERE COLORS ARE LOCATED,0))
 
Upvote 0
No
The name comes in same column as color.
Color fields for particular name below name with data in next column.
 
Upvote 0
John John
Red12John
Blue324John
Pink34John
Paula Paula
Green1234Paula
Red112Paula
your data is poorly laid out for analysis
this helper column - which can be hidden away
which is generated by formula
makes life much easier
so if you want
John
Blue
324
=SUMPRODUCT((C2:C8=B22)*(A2:A8=B23)*(B2:B8))

<colgroup><col span="9"></colgroup><tbody>
</tbody>
 
Upvote 0
Yes the data comes in horribly. It is how they are going to give it to me, though I offered to fix for them.
I will look into way suggested see if it works quicker than solution I came up with.
Many thanks.
The issue might be, that I really do not know the difference from all the names and colors. And the name rows actually have data in column B as well.
I do know when I get data what is what except for the fact that color for the name will be below.
I will always be looking to pull (a name and a color) that's why I was hoping to drop down in the table and then pull from there. The two fields are actually departments and locations. And the departments share locations often.
And there should always be some result for the department/location if I am making an inquiry so that is why I am not concerned about pulling past the departments data. Just do not want to pull location before I reach the departments data.

Many thanks for the help.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,506
Messages
6,125,197
Members
449,214
Latest member
mr_ordinaryboy

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