View Single Post
  #13   Report Post  
Posted to microsoft.public.excel.misc
No Name
 
Posts: n/a
Default totally lost - named range and vlookup

Jim,
Thanks for the explanation. Often things like this are very difficult to
sort out in
standard "help" mechanisms. This is actually quite fun, if you don't mind
pulling a few hairs out!

"Jim Thomlinson" wrote:

Volatile referes to a function that must re-calculate every time a
calculation runs. Now() is a good example. Each time a calculation runs it
retrieves the most current time. Offset is a volatile function so it has a
bit more overhead as it will be constantly recalculating. That is not a big
deal if you only have few such formulas. If you have thousands of them then
you may notice that your calculations take a long time to run.

Since you are using offset to create the dynamic range any function that
uses that range is by defualt volatile and has a bit more calc overhead.
Throwing a second offset on top of the dynamic range does not force the
function to calc twice.

I personally do not use VLookup (almost never). VLookup is one of the most
dangerous formulas that most people use. The reason is that it hard codes the
number of columns over to look. If you insert a column into your source data
then VLookup will be returning the wrong columns data. That one can be very
difficult to debug. Using Index/Match or Offset as I have in this example the
columns over is not hard coded and if a column is inserted then it will still
return the correct value.
--
HTH...

Jim Thomlinson


"< AVG Joe" wrote:

Thanks for the clarification, Jim. The new lookup returns the amount one row
after
what was looked looked up. I thus changed $B$2 to $B:$B
This seems to work.

I guess the larger question now is: which way is "less volatile"?
Two named ranges, & vlookup, or the two offsets?

"Jim Thomlinson" wrote:

You could define a seperate named range and that would work just fine. You
could also use the formulas I posted in my last reply. Using that method you
could get away with just one dynamic named range...
--
HTH...

Jim Thomlinson


"< AVG Joe" wrote:

First -thanks for everybody's help- but I think I need to rephrase the new
problem
I declared the dynamic range for all 3 columns and the offset for text in
row one - the lookup now works fine.

What also happened is that I was using the named range in a data validation,
so that the user could only select from the text itemsL
Bed
Table
and so on...

What has happened now is that the DV dropdown shows all three valuesL
Bed
2.50
ea

So in order to have the DV dropdown only contains the text items, I need to
define a separate dynamic range for that column only, is that correct?

"Jim Thomlinson" wrote:

One way would be to not use the vlookup... Since you are using a dynamic
named range your funciton is already volatile so there is no harm in using
offset again...

You dynamic named range will be...
=OFFSET(MasterContentsList!$A$2,0,0,COUNTA(MasterC ontentsList!$A:$A)-1,1)

Your lookup formula will be
=offset(MasterContentsList!$B$2, match(B12, ItemList,0), 0,1,1)
--
HTH...

Jim Thomlinson


"< AVG Joe" wrote:

Spoke too soon?
Now the dynamic range works, but the DV list that uses shows all three rows?
When I dropdown the list I see:
Bed
2.50
ea

et al.

Does this mean i have to define a separate range for only the first column?

"< AVG Joe" wrote:

I have a sheet with a layout as such:
A B C
Bed 2.50 ea
Table 1.00 ea

I have tried to specify a dynamic named range ("ItemList" )as so:
=OFFSET(MasterContentsList!$A$2,0,0,COUNTA(MasterC ontentsList!$A:$A),1)

The range always includes an empty cell at the bottom of the list. I have
deleted everyting below to end, but no change? This is causing the DV list to
start at the bottom with a blank...

Secondly, when I try to use that named range in a VLOOKUP, to retrieve the
amount, I get a #REF error. Here is the formula I am using for VLOOKUP:
=IF(ISBLANK(B12),"",VLOOKUP(B12,ItemList,2,FALSE))
Are the errors related? What am I doing wrong