PC Review


Reply
Thread Tools Rate Thread

Can I use HLookup with an internally defined array?

 
 
plh
Guest
Posts: n/a
 
      10th Nov 2009
That is, one that is not taken from the spreadsheet.
Before I start banging my head against the wall, I thought I would ask
the experts!
Something like:

Sub MySub
Dim HLookupArray as Variant
Dim n,m as Long
n = Something
m = SomethingElse
LookupVal = SomethingElseYet
HLookupArray = Array(n,m)

(In hear put code assigning values to the array nodes)

SlowWalker = Application.HLookup(LookupVal, HLookupArray, 4, False)

End Sub

Thank You,
-plh
 
Reply With Quote
 
 
 
 
Charles Williams
Guest
Posts: n/a
 
      10th Nov 2009
Yes, something like that or using VLOOKUP should work (but its probably
slower than just searching the array with a loop, unless the array is
sorted)


Charles
___________________________________
The Excel Calculation Site
http://www.decisionmodels.com

"plh" <(E-Mail Removed)> wrote in message
news:c569f476-ae29-41f1-bf38-(E-Mail Removed)...
> That is, one that is not taken from the spreadsheet.
> Before I start banging my head against the wall, I thought I would ask
> the experts!
> Something like:
>
> Sub MySub
> Dim HLookupArray as Variant
> Dim n,m as Long
> n = Something
> m = SomethingElse
> LookupVal = SomethingElseYet
> HLookupArray = Array(n,m)
>
> (In hear put code assigning values to the array nodes)
>
> SlowWalker = Application.HLookup(LookupVal, HLookupArray, 4, False)
>
> End Sub
>
> Thank You,
> -plh
>



 
Reply With Quote
 
plh
Guest
Posts: n/a
 
      13th Nov 2009
On Nov 10, 9:42*am, "Charles Williams" <Char...@DecisionModels.com>
wrote:
> Yes, something like that or using VLOOKUP should work (but its probably
> slower than just searching the array with a loop, unless the array is
> sorted)
>
> Charles
> ___________________________________
> The Excel Calculation Sitehttp://www.decisionmodels.com
>
> "plh" <aus.robus...@gmail.com> wrote in message
>
> news:c569f476-ae29-41f1-bf38-(E-Mail Removed)...
>
> > That is, one that is not taken from the spreadsheet.
> > Before I start banging my head against the wall, I thought I would ask
> > the experts!
> > Something like:

>
> > Sub MySub
> > Dim HLookupArray as Variant
> > Dim n,m as Long
> > n = Something
> > m = SomethingElse
> > LookupVal = SomethingElseYet
> > HLookupArray = Array(n,m)

>
> > (In hear put code assigning values to the array nodes)

>
> > SlowWalker = Application.HLookup(LookupVal, HLookupArray, 4, False)

>
> > End Sub

>
> > Thank You,
> > -plh


Thank You! I would have thought it would be faster in general.
-plh
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
hlookup in array BorisS Microsoft Excel Misc 2 31st Aug 2009 11:49 PM
HLOOKUP: specify table array in a cell Melanie Microsoft Excel New Users 3 20th Aug 2009 09:30 PM
array formula with if and hlookup =?Utf-8?B?YnBvcnQgamlt?= Microsoft Excel Worksheet Functions 5 8th Jan 2007 03:26 AM
HLookup? or an array function?? =?Utf-8?B?TXVycGg=?= Microsoft Excel Worksheet Functions 5 11th May 2005 05:44 PM
How do I find a value in an array (VLOOKUP? HLOOKUP?) M Skabialka Microsoft Excel New Users 2 11th Mar 2005 02:52 AM


Features
 

Advertising
 

Newsgroups
 


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