PC Review


Reply
Thread Tools Rate Thread

Calculating Conditional Standard Deviation?

 
 
=?Utf-8?B?SGFyaW1hdQ==?=
Guest
Posts: n/a
 
      27th Jun 2007
Hi there,

I have two columns - Industry Code and Market Cap. I want to create a
summary table for average market cap and standard deviation for certain
Industries. However, there are like 20 different industry codes and I didn't
exactly feel like doing it manually for 20 cells. I tried out this formula
first:

{=STDEV((--($E$2:$E$296=K17))*$F$2:$F$296/1000000)}

Using it an array - the Ctrl+Shift+Enter thing. That didn't work out too well.

Cells E2:E296 contained the Industry Code column. Cells F2:F296 contained
the market capitlisations, while K17 was one of the 20 industry codes.

I think the reason why it didn't work (apart from probably wrong usage of
the double negatives on my part) was that it produced zeros for the companies
that I didn't want to include, which could screw up the STDEV calc, since it
includes any zeros in the calculations.

Is there any way around this?

I thought there might be another way by using standard deviation = square
root (expected value of x^2 - (average of x)^2 ) but couldn't really figure
out how to do a conditional squared sum. Is there of a way of doing that?

Thanks in advance,

Iwan J
 
Reply With Quote
 
 
 
 
=?Utf-8?B?SGFyaW1hdQ==?=
Guest
Posts: n/a
 
      27th Jun 2007
Nevermind, I figured out a way by using OFFSET.

However, I would still be curious if there was another way of doing this...

"Harimau" wrote:

> Hi there,
>
> I have two columns - Industry Code and Market Cap. I want to create a
> summary table for average market cap and standard deviation for certain
> Industries. However, there are like 20 different industry codes and I didn't
> exactly feel like doing it manually for 20 cells. I tried out this formula
> first:
>
> {=STDEV((--($E$2:$E$296=K17))*$F$2:$F$296/1000000)}
>
> Using it an array - the Ctrl+Shift+Enter thing. That didn't work out too well.
>
> Cells E2:E296 contained the Industry Code column. Cells F2:F296 contained
> the market capitlisations, while K17 was one of the 20 industry codes.
>
> I think the reason why it didn't work (apart from probably wrong usage of
> the double negatives on my part) was that it produced zeros for the companies
> that I didn't want to include, which could screw up the STDEV calc, since it
> includes any zeros in the calculations.
>
> Is there any way around this?
>
> I thought there might be another way by using standard deviation = square
> root (expected value of x^2 - (average of x)^2 ) but couldn't really figure
> out how to do a conditional squared sum. Is there of a way of doing that?
>
> Thanks in advance,
>
> Iwan J

 
Reply With Quote
 
T. Valko
Guest
Posts: n/a
 
      27th Jun 2007
Try it like this: (array entered)

=STDEV(IF($E$2:$E$296=K17,$F$2:$F$296/1000000))

Biff

"Harimau" <(E-Mail Removed)> wrote in message
news:F3B6CD21-1A33-4B85-A126-(E-Mail Removed)...
> Hi there,
>
> I have two columns - Industry Code and Market Cap. I want to create a
> summary table for average market cap and standard deviation for certain
> Industries. However, there are like 20 different industry codes and I
> didn't
> exactly feel like doing it manually for 20 cells. I tried out this formula
> first:
>
> {=STDEV((--($E$2:$E$296=K17))*$F$2:$F$296/1000000)}
>
> Using it an array - the Ctrl+Shift+Enter thing. That didn't work out too
> well.
>
> Cells E2:E296 contained the Industry Code column. Cells F2:F296 contained
> the market capitlisations, while K17 was one of the 20 industry codes.
>
> I think the reason why it didn't work (apart from probably wrong usage of
> the double negatives on my part) was that it produced zeros for the
> companies
> that I didn't want to include, which could screw up the STDEV calc, since
> it
> includes any zeros in the calculations.
>
> Is there any way around this?
>
> I thought there might be another way by using standard deviation = square
> root (expected value of x^2 - (average of x)^2 ) but couldn't really
> figure
> out how to do a conditional squared sum. Is there of a way of doing that?
>
> Thanks in advance,
>
> Iwan J



 
Reply With Quote
 
=?Utf-8?B?SGFyaW1hdQ==?=
Guest
Posts: n/a
 
      27th Jun 2007
It didn't work, unfortunately.

"T. Valko" wrote:

> Try it like this: (array entered)
>
> =STDEV(IF($E$2:$E$296=K17,$F$2:$F$296/1000000))
>
> Biff
>
> "Harimau" <(E-Mail Removed)> wrote in message
> news:F3B6CD21-1A33-4B85-A126-(E-Mail Removed)...
> > Hi there,
> >
> > I have two columns - Industry Code and Market Cap. I want to create a
> > summary table for average market cap and standard deviation for certain
> > Industries. However, there are like 20 different industry codes and I
> > didn't
> > exactly feel like doing it manually for 20 cells. I tried out this formula
> > first:
> >
> > {=STDEV((--($E$2:$E$296=K17))*$F$2:$F$296/1000000)}
> >
> > Using it an array - the Ctrl+Shift+Enter thing. That didn't work out too
> > well.
> >
> > Cells E2:E296 contained the Industry Code column. Cells F2:F296 contained
> > the market capitlisations, while K17 was one of the 20 industry codes.
> >
> > I think the reason why it didn't work (apart from probably wrong usage of
> > the double negatives on my part) was that it produced zeros for the
> > companies
> > that I didn't want to include, which could screw up the STDEV calc, since
> > it
> > includes any zeros in the calculations.
> >
> > Is there any way around this?
> >
> > I thought there might be another way by using standard deviation = square
> > root (expected value of x^2 - (average of x)^2 ) but couldn't really
> > figure
> > out how to do a conditional squared sum. Is there of a way of doing that?
> >
> > Thanks in advance,
> >
> > Iwan J

>
>
>

 
Reply With Quote
 
T. Valko
Guest
Posts: n/a
 
      27th Jun 2007
Hmmm....

Well, it was the corrected equivalent of:

> {=STDEV((--($E$2:$E$296=K17))*$F$2:$F$296/1000000)}


You were correct in your assumption about producing 0's and skewing the
result.

Just multiplying: ($E$2:$E$296=K17)*$F$2:$F$296/1000000

Will produce the 0's so the double unary in this case was redundant.

The syntax I used takes care of that.

Biff

"Harimau" <(E-Mail Removed)> wrote in message
news:3981FB2E-C133-4E4F-A916-(E-Mail Removed)...
> It didn't work, unfortunately.
>
> "T. Valko" wrote:
>
>> Try it like this: (array entered)
>>
>> =STDEV(IF($E$2:$E$296=K17,$F$2:$F$296/1000000))
>>
>> Biff
>>
>> "Harimau" <(E-Mail Removed)> wrote in message
>> news:F3B6CD21-1A33-4B85-A126-(E-Mail Removed)...
>> > Hi there,
>> >
>> > I have two columns - Industry Code and Market Cap. I want to create a
>> > summary table for average market cap and standard deviation for certain
>> > Industries. However, there are like 20 different industry codes and I
>> > didn't
>> > exactly feel like doing it manually for 20 cells. I tried out this
>> > formula
>> > first:
>> >
>> > {=STDEV((--($E$2:$E$296=K17))*$F$2:$F$296/1000000)}
>> >
>> > Using it an array - the Ctrl+Shift+Enter thing. That didn't work out
>> > too
>> > well.
>> >
>> > Cells E2:E296 contained the Industry Code column. Cells F2:F296
>> > contained
>> > the market capitlisations, while K17 was one of the 20 industry codes.
>> >
>> > I think the reason why it didn't work (apart from probably wrong usage
>> > of
>> > the double negatives on my part) was that it produced zeros for the
>> > companies
>> > that I didn't want to include, which could screw up the STDEV calc,
>> > since
>> > it
>> > includes any zeros in the calculations.
>> >
>> > Is there any way around this?
>> >
>> > I thought there might be another way by using standard deviation =
>> > square
>> > root (expected value of x^2 - (average of x)^2 ) but couldn't really
>> > figure
>> > out how to do a conditional squared sum. Is there of a way of doing
>> > that?
>> >
>> > Thanks in advance,
>> >
>> > Iwan J

>>
>>
>>



 
Reply With Quote
 
=?Utf-8?B?SmVycnkgVy4gTGV3aXM=?=
Guest
Posts: n/a
 
      27th Jun 2007
Please clarify the meaning of "It didn't work". If array entered, the
formula will produce the standard deviation of the values in column F divided
by 1000000 that correspond to values in column E which equal K17. Was the
formula not array entered, or was that standard deviation not what you
wanted?

Another possibility is that there may be issues with the matching to K17.
IF K17 appears to be a number, either it or some of the "matching values" may
be a string instead of a number, an therefore not a match. If K17 is
supposed to be a string, there may be differences in trailing spaces that
prevent a match.

Jerry

"Harimau" wrote:

> It didn't work, unfortunately.
>
> "T. Valko" wrote:
>
> > Try it like this: (array entered)
> >
> > =STDEV(IF($E$2:$E$296=K17,$F$2:$F$296/1000000))
> >
> > Biff

 
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
Re: Calculating Standard Deviation Mike Painter Microsoft Access Form Coding 0 17th Jun 2009 06:42 AM
Re: Calculating Standard Deviation Tom van Stiphout Microsoft Access Form Coding 0 17th Jun 2009 06:28 AM
Calculating Standard Deviation while ignoring Zeros kendrickmr@gmail.com Microsoft Excel Programming 5 22nd Jan 2007 01:53 AM
Calculating Standard Deviation? Scott Microsoft VB .NET 3 3rd Apr 2006 07:37 PM
calculating standard deviation Bob Weiner Microsoft Excel Discussion 1 4th Feb 2004 06:25 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:47 AM.