Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
multidimensional lookup?
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
size of multidimensional dynamic array | Excel Programming | |||
Declare Multidimensional Arrays | Excel Programming | |||
Declare Multidimensional Arrays | Excel Programming | |||
Multidimensional Arrays - VBA | Excel Programming | |||
Multidimensional Arrays - VBA | Excel Programming |