returning an array from a custom function

R

Ron Davis

I have a custom function that returns five values as an
array. If I call the array function from a row of five
cells it works fine. But if I call the function from a
column of five cells, it returns the first value of the
return array five times. It seems to think that all
arrays are rows! I thought that an array would be a row
or column depending on circumstances. What rule am I
missing here, or is this an honest error in EXCEL?

Ron Davis
Mathematical Programming Services
 
C

Charles Williams

Hi Ron,

It always returns a row, but repeats the row 5 times if you call it from a
column. Try calling it from a 5 by 5 range to see this.

So my array functions mostly return a two-dimensional array, even if one of
the dimensions is one long.
Other people like to use TRANSPOSE to switch the row to a column.


hth
Charles
______________________
Decision Models
The Excel Calculation Site
www.DecisionModels.com
 
A

Alan Beban

Ron said:
It seems to think that all
arrays are rows!

More likely, your function *defines* the output array as a horizontal
array. As was suggested, instead of finishing up your function with
something like

FunctionName = myArray, try
FunctionName = Application.Transpose(myArray)

Alan Beban
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top