Returning arrays

G

Guest

I have written a user defined function that returns an array.

I want to insert this function into a cell on my worksheet and have a
specific member of the array appear in the cell.

What is the syntax for the formula in the cell on the worksheet that will
access a specific element in the array returned from my function?

Thanks in advance for your help.
 
B

Bob Phillips

INDEX into it like this

=INDEX(myfunc(A1:A5),3)

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
G

Guest

in VB the syntax would be:

OneElement = MyFunc(Whatever)(1)
NextElement = MyFunc(Whatever)(2)
etc.

unfortunately including the trailing element number doesn't work when the
function is used as a cell formula

=MyFunc(Whatever)(1)

What I would do is add an optional Arg to return just the one element desired:

=MyFunc(Whatever,1)
 
A

Alan Beban

=INDEX(MyFunction(),3,4) for the array element in the 3d "row", 4th
"column" of the array returned by the function "MyFunction".

Alan Beban
 
G

Guest

I learned something new from you and Bob

Alan Beban said:
=INDEX(MyFunction(),3,4) for the array element in the 3d "row", 4th
"column" of the array returned by the function "MyFunction".

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