Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 203
Default Easy (for you) question

Hello!
I'm trying to get the standard deviation of the values in a one dimentional
array.
Excel obviously has the function, but the necesary argument is a range.
I was thinking of calculating the st.dev manually, but that not very cool.
Is there a way of using the items in an array as the arguments for the
Standard Deviation Worksheet.Function?
Thanks in advance,
Albert C
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 274
Default Easy (for you) question

When called from VBA you can pass it an array:

Sub Test()
Dim A As Variant
A = Array(1, 2, 1, 4, 2, 3)
MsgBox Application.WorksheetFunction.StDev(A)
End Sub

(or StDevP(A) as the case may be)

Hope this helps

-John Coleman

Albert wrote:
Hello!
I'm trying to get the standard deviation of the values in a one dimentional
array.
Excel obviously has the function, but the necesary argument is a range.
I was thinking of calculating the st.dev manually, but that not very cool.
Is there a way of using the items in an array as the arguments for the
Standard Deviation Worksheet.Function?
Thanks in advance,
Albert C


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Easy (for you) question

This worked ok for me:


Albert wrote:

Hello!
I'm trying to get the standard deviation of the values in a one dimentional
array.
Excel obviously has the function, but the necesary argument is a range.
I was thinking of calculating the st.dev manually, but that not very cool.
Is there a way of using the items in an array as the arguments for the
Standard Deviation Worksheet.Function?
Thanks in advance,
Albert C


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Easy (for you) question

This (still) worked ok for me:

Option Explicit
Sub testme01()
Dim myArr As Variant
myArr = Array(1, 2, 3, 4, 5)
MsgBox Application.StDev(myArr)
End Sub


I could use this, too:
MsgBox Application.WorksheetFunction.StDev(myArr)

Albert wrote:

Hello!
I'm trying to get the standard deviation of the values in a one dimentional
array.
Excel obviously has the function, but the necesary argument is a range.
I was thinking of calculating the st.dev manually, but that not very cool.
Is there a way of using the items in an array as the arguments for the
Standard Deviation Worksheet.Function?
Thanks in advance,
Albert C


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 203
Default Easy (for you) question

Thank you sir,
Worked Great.

"Dave Peterson" wrote:

This (still) worked ok for me:

Option Explicit
Sub testme01()
Dim myArr As Variant
myArr = Array(1, 2, 3, 4, 5)
MsgBox Application.StDev(myArr)
End Sub


I could use this, too:
MsgBox Application.WorksheetFunction.StDev(myArr)

Albert wrote:

Hello!
I'm trying to get the standard deviation of the values in a one dimentional
array.
Excel obviously has the function, but the necesary argument is a range.
I was thinking of calculating the st.dev manually, but that not very cool.
Is there a way of using the items in an array as the arguments for the
Standard Deviation Worksheet.Function?
Thanks in advance,
Albert C


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Easy question Excel Wired Excel Discussion (Misc queries) 2 July 29th 09 04:53 PM
*EASY* question 2!! Laura \( '_' \) New Users to Excel 3 November 25th 05 02:01 PM
Easy Question dok112[_40_] Excel Programming 2 July 20th 05 11:48 PM
new user with easy question? not easy for me speakeztruth New Users to Excel 5 June 3rd 05 09:40 PM
Probably the most easy question here... JasonS[_2_] Excel Programming 1 October 8th 04 12:08 AM


All times are GMT +1. The time now is 11:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"