PC Review


Reply
Thread Tools Rate Thread

Accessing individual elements of an array returned by a function

 
 
tkpmep@hotmail.com
Guest
Posts: n/a
 
      19th Mar 2008
If I call an Excel function (e.g. Linest) that returns an array (in
the case of Linest, the slope and the intercept), how can I access one
particular element of the array that is returned?

If I select two cells, type =Linest(a1:a10,b1:b10) in one and then hit
Ctl-Shift-Enter to enter an array formula, both the slope and the
intercept are returned, one in each cell. But what if I want just the
slope or just the intercept? I tried entering =Linest(a1:a10,b1:b10)
(1) in a single cell but got only an error. What am I doing wrong? I'm
aware that in this particular case, I could use the Slope() and
Intercept() functions separately to get what I want, but there has to
be a general solution for any function that returns an array.

Sincerely

Thomas Philips
 
Reply With Quote
 
 
 
 
Alan Beban
Guest
Posts: n/a
 
      19th Mar 2008
(E-Mail Removed) wrote:
> If I call an Excel function (e.g. Linest) that returns an array (in
> the case of Linest, the slope and the intercept), how can I access one
> particular element of the array that is returned?
>
> If I select two cells, type =Linest(a1:a10,b1:b10) in one and then hit
> Ctl-Shift-Enter to enter an array formula, both the slope and the
> intercept are returned, one in each cell. But what if I want just the
> slope or just the intercept? I tried entering =Linest(a1:a10,b1:b10)
> (1) in a single cell but got only an error. What am I doing wrong? I'm
> aware that in this particular case, I could use the Slope() and
> Intercept() functions separately to get what I want, but there has to
> be a general solution for any function that returns an array.
>
> Sincerely
>
> Thomas Philips

If the two cells you selected are in one column, you might try

=INDEX(Linest(A1:A10,B1:B10),1,1) for the slope,

=INDEX(Linest(A1:A10,B1:B10),2,1) for the intercept.

If the two selected cells were in one row, try

=INDEX(Linest(A1:A10,B1:B10),1,1) for the slope,

=INDEX(Linest(A1:A10,B1:B10),1,2) for the intercept.

Alan Beban
 
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
Passing array elements to a function Geoff Microsoft Excel Programming 2 23rd May 2008 05:30 PM
Accessing individual items in an array returned by a function tkpmep@hotmail.com Microsoft Excel Programming 2 4th Dec 2007 04:03 PM
Transpose Function not Working with Long Array Elements =?Utf-8?B?Tmdhbg==?= Microsoft Excel Programming 4 10th Aug 2005 12:16 AM
Accessing function and elements from one form on other =?Utf-8?B?U2VyZ2V5IFJvbWFub3Y=?= Microsoft C# .NET 2 24th Sep 2004 06:35 AM
Accessing elements of an array Krish Microsoft C# .NET 2 24th Jun 2004 11:14 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:26 PM.