Looking up a value based on row and column

DavidPonnet

New Member
Joined
Mar 16, 2017
Messages
23
I am currently working on a big project, and need to fill in the pricing schedule.

In table 1, I would like an easy way to fill in the question marks. I have over 150 "cars" to fill in, so I am looking for the best solution to get this automated. I am used to work with Vlookup, but I have over 250 columns in my table 2 and would like to look on name instead of column number

[TABLE="width: 500"]
<tbody>[TR]
[TD]Table 1[/TD]
[TD][/TD]
[TD][/TD]
[TD]Table 2[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Car 1[/TD]
[TD]€[/TD]
[TD][/TD]
[TD][/TD]
[TD]Glass[/TD]
[TD]Light[/TD]
[TD]Locks[/TD]
[TD]Wheel[/TD]
[/TR]
[TR]
[TD]Glass[/TD]
[TD]???[/TD]
[TD][/TD]
[TD]Car 1[/TD]
[TD]250
[/TD]
[TD]50[/TD]
[TD]200[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Light[/TD]
[TD]???[/TD]
[TD][/TD]
[TD]Car 2[/TD]
[TD]150[/TD]
[TD]150[/TD]
[TD]200[/TD]
[TD]500[/TD]
[/TR]
[TR]
[TD]Locks[/TD]
[TD]???[/TD]
[TD][/TD]
[TD]Car 3[/TD]
[TD]50[/TD]
[TD][/TD]
[TD]200[/TD]
[TD]500[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Car 2[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Glass[/TD]
[TD]???[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Light[/TD]
[TD]???[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Locks[/TD]
[TD]???[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Wheels[/TD]
[TD]???[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Car 3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Glass[/TD]
[TD]???[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Locks[/TD]
[TD]???[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Wheels[/TD]
[TD]???[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited by a moderator:

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Comment:
My formula in post 5 is certainly more complex, but was designed so that the same formula could be copied to all the required cells without having to manually adjust the $A$4 to $A$10 etc in each section. I note that in your formulas in post 9 you have not made that adjustment for Car 3 and so those formulas will be in fact returning results for Car 1. However, I don't have a problem with using such a formula and adjusting the lookup cell for each section as it does make the formulas somewhat simpler.

Suggestion:
Instead of using the construct
=VLOOKUP($A$4,D:H,MATCH($A6,INDEX(D:H,3,0),0),0)
I would use the simpler and more direct
=VLOOKUP($A$4,D:H,MATCH($A6,D$3:H$3,0),0)
as, apart from being shorter and avoiding another function call, it will self-adjust if rows are subsequent inserted above the current header row whereas the current formulas will return incorrect results in that case.
 
Upvote 0
[...]
Suggestion:
Instead of using the construct
=VLOOKUP($A$4,D:H,MATCH($A6,INDEX(D:H,3,0),0),0)
I would use the simpler and more direct
=VLOOKUP($A$4,D:H,MATCH($A6,D$3:H$3,0),0)
as, apart from being shorter and avoiding another function call, it will self-adjust if rows are subsequent inserted above the current header row whereas the current formulas will return incorrect results in that case.

The idea is to have a TABLE (defined) of which the first row consists of headers:

VLOOKUP(look-up-value,TABLE,MATCH(headervalue,INDEX(TABLE,1,0),[1|0]),[1/0])
 
Upvote 0
The idea is to have a TABLE (defined) ...
Well, that is a new idea as there was no mention of a defined table before and the OP didn't have one, but worth considering.



..of which the first row consists of headers:

VLOOKUP(look-up-value,TABLE,MATCH(headervalue,INDEX(TABLE,1,0),[1|0]),[1/0])
If the first row of the formal table is headers, then that would need to be
VLOOKUP(look-up-value,TABLE,MATCH(headervalue,INDEX(TABLE[#All],1,0),[1|0]),[1/0])
otherwise it would be indexing the first row of data, not the headers, and there would be no match.

However, as I suggested previously, I would still go directly to the headers rather than via an additional function. So for the OP's example, if there was a formal table called TABLE, I would suggest
=VLOOKUP($A$4,TABLE,MATCH(A6,TABLE[#Headers],0),0)
 
Upvote 0
Well, that is a new idea as there was no mention of a defined table before and the OP didn't have one, but worth considering.
[...]

I wasn't talking about a table obtained by Insert | Table, rather a table that is defined using the Name Box or the Name Manager of which the top row is generally the header row. When that is the case, nothing is wrong with:

VLOOKUP(look-up-value,TABLE,MATCH(headervalue,INDEX(TABLE,1,0),[1|0]),[1/0])

despite the INDEX() call.
 
Upvote 0
I wasn't talking about a table obtained by Insert | Table, rather a table that is defined using the Name Box or the Name Manager ...
Fair enough (unfortunately "table" is easy to mis-interpret in Excel terms) and what you said following is correct, but in that case is there an advantage over the simpler formula suggested in post 13?
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,971
Members
452,371
Latest member
Frana

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