Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
size of multidimensional dynamic array ThatFella[_2_] Excel Programming 4 September 3rd 03 11:53 PM
Declare Multidimensional Arrays Alan Beban[_3_] Excel Programming 3 August 21st 03 02:40 AM
Declare Multidimensional Arrays Alan Beban[_3_] Excel Programming 0 August 20th 03 07:03 PM
Multidimensional Arrays - VBA Brent McIntyre Excel Programming 3 August 11th 03 09:01 AM
Multidimensional Arrays - VBA Brent McIntyre Excel Programming 14 August 8th 03 10:49 PM


All times are GMT +1. The time now is 07:07 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"