Solved

Change vlookup-range in function

Posted on 2011-03-25
3
185 Views
Last Modified: 2012-08-14
Hello,

I want to create a function that looks in a certain range for a certain value

The name of the range is in cell B1, de value that needs to be looked up is ie cell A1. I have several ranges: BE_UP, BE_DOWN, NL_UP, NL_DOWN. They are al defined

In cell A1 I enter the value that I'm looking for
In Cell B1, I enter the value of the range that he needs looking in

first question: is it possible to do this with the norma vlookup-formula

Second question: in the code below, I tried it, but I do not get any value
 
Function VLOOKUPGV(oRNGSearch As Range, oRNGLookup As Range, iCol As Integer, bTemp As Boolean) 

Dim sRange As String
Dim dtLookup

VLOOKUPGV = Application.WorksheetFunction.VLookup(oRNGSearch.value, Application.Range(oRNGLookup.value), iCol, True)

End Function

Open in new window


What is going wrong ?

Thank you very much
0
Comment
Question by:Steven Vermoere
  • 2
3 Comments
 
LVL 39

Expert Comment

by:nutsch
ID: 35217201
use indirect to convert a range string to an actual range

=vlookup(a1,indirect("B1"),2,0)

Thomas
0
 
LVL 39

Accepted Solution

by:
nutsch earned 250 total points
ID: 35217207
not indirect("B1"), indirect(B1), sorry

=vlookup(a1,indirect(B1),2,0)

Thomas
0
 

Author Closing Comment

by:Steven Vermoere
ID: 35230486
Yes, this was it. Thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question