Solved

Change vlookup-range in function

Posted on 2011-03-25
3
174 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now