View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Harlan Grove
 
Posts: n/a
Default indirect using name

"tocguy" wrote...
....
While upgrading the analysis spreadsheet, I attempted to move "BusName" to
a
cell on a worksheet thus replacing the Defined Name; "BusName" now points
to
the same formula but within a cell. Now, "BusName" returns only the first
cell of the array referenced by {=INDIRECT(dbName&"F4:F"&dbLastRow)}.

Why does the same formula with the same name built with the same variables
act differently on the Worksheet level as opposed to the Workbook level?
The
formula includes the worksheet name so the reference appears to be
complete.
What gives?


This has nothing to do with worksheet vs workbook level names and everything
to do with names defined as expressions vs names referring to
literal/constant ranges.

Excel evaluates names as their values. For names referring to expressions
rather than ranges, e.g., X referring to ={1,2}+{3;4}, the value of the name
X is the value of the expression, in this case, {4,5;5,6}, so an array of 4
values. For names referring to ranges, e.g., Y referring to cell Y99 in
which Y99 contains the formula ={1,2}+{3;4} whether entered as an array
formula or not, the value of the range Y99 is the value of *ONLY* cell Y99,
i.e., 4. The only way Y referring to a range could return an array of values
is for it to be defined as the multiple cell range Y99:Z100 with Y99:Z100
together containing the array formula ={1,2}+{3;4}.

So you were too clever. Since your referent range would seem to vary in
size, it'd be wasteful to use up another range dereferencing it. You should
revert to BusName referring to the expression
=INDIRECT(dbName&"F4:F"&dbLastRow).