• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 494
  • Last Modified:

Excel VBA, How can I create a Vlookup with a dynamic Lookup value

For example
I have a sheet where Col A has an ID and I need to match that ID then find the coresponding col from the Vlookup but the sheet is a monthly record so each month the lookup value needs to change.
In the example following, last month was RC-9
"VLOOKUP(RC-10,P01Currentmonth.csv!R1C24:R158C29,6,FALSE)" Source view
This is just one part of a large macro.
0
Mitch Swetsky
Asked:
Mitch Swetsky
1 Solution
 
Rory ArchibaldCommented:
If you always want to look up column A, then refer to it as RC1 rather than using a relative column:
"VLOOKUP(RC1,P01Currentmonth.csv!R1C24:R158C29,6,FALSE)"
0
 
Rob HensonFinance AnalystCommented:
Or rather than using vlookup use straight lookup using syntax:

Lookup(lookupvalue, lookup array, result array)

The result array is then the only dynamic range.

Thanks
Rob H
0
 
Mitch SwetskyBusiness AnalystAuthor Commented:
Thank You
I thought that RC was relative to the currect position.
That is just what I was looking for.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now