View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
J.E. McGimpsey J.E. McGimpsey is offline
external usenet poster
 
Posts: 493
Default multidimensional lookup?

One way:

Dim result As Variant
Dim lookup_Value As Variant
lookup_Value = Range("C1").Value
result = Columns(1).Cells.Find( _
What:=lookup_Value, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
MatchCase:=False).Offset(2, 1).Value
MsgBox result


If it's not guaranteed that the lookup_value will be found, you can
use something like:

Dim found As Range
Dim result As Variant
Dim lookup_Value As Variant
lookup_Value = Range("C1").Value
Set found = Columns(1).Cells.Find( _
What:=lookup_Value, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
MatchCase:=False)
If Not found Is Nothing Then result = found.Offset(2, 1).Value
MsgBox result



In article ,
"Lightspeed" wrote:

I would like to know if it is possible to return a value
by specifying how far away (in rows and columns) the
result is from the lookup_value. For example, I would
like to look up today's date from a column list, and then
return the value that is one column over and 2 rows down.
Please let me know if this is even possible.