+ Reply to Thread
Results 1 to 9 of 9

Use IF statement in STDEV function?

  1. #1
    Registered User
    Join Date
    12-28-2012
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2013
    Posts
    31

    Use IF statement in STDEV function?

    Is there a way to conditionally include a value in a standard deviation calculation without having to type it out manually? I have the following spreadsheet which shows what I mean. The only way I can get it to work is to type the standard deviation calculation out manually which adds a lot of processing time.

    Thanks
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: Use IF statement in STDEV function?

    Array-enter (press ctrl+shift+Enter instead of just Enter) the following formula:

    =IFERROR(STDEV(IF(I5:I9="yes",H5:H9)),"")

    The essential formula is the red-highlighted part. The IFERROR wrapper covers the case when your IF condition selects one or zero rows.

    BTW, you have the wrong formula H20. It should be =STDEV(H5,H7:H9).

    And you should consider using STDEVP instead of STDEV.

    STDEVP is the "true" (actual) std dev. STDEV is an estimated std dev of a larger "population" (data), assuming the given data is a representative sampling.

  3. #3
    Registered User
    Join Date
    12-28-2012
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2013
    Posts
    31

    Re: Use IF statement in STDEV function?

    Thanks. I will try it out. I made the example sheet in about 60 seconds cause I had to go so no surprise on the error. I'm no statistician, but isn't the STDEV more accurate in this case because you could have infinite replicates, so the population is actually larger than what I'm looking at?

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,099

    Re: Use IF statement in STDEV function?

    STDEVP should be used ONLY when you have sampled the entire population (what is the SD of the weight of 100 cows in a 100 cow herd) whereas STDEVS should be used when you have taken as sample (what is the SD of 25 cows in a 100 cow herd). Given that you are including the possibility of excluding some values, for some unspecified reason (statistically justifiable??), you should use STDEVS.

    So far as I know....
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  5. #5
    Registered User
    Join Date
    12-28-2012
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2013
    Posts
    31

    Re: Use IF statement in STDEV function?

    I'm not sure but for my 12 years in industry, I've always seen STDEV used by everyone, so I need to do more research as to formulate a convincing argument if that's wrong.

    I don't think I even have a known population , because the replicates could be infinite.
    Last edited by finalmike; 08-18-2018 at 12:41 PM.

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,099

    Re: Use IF statement in STDEV function?

    As far as I remember STDEV = STDEVS. It's just an outdated Excel function that is still included for the purposes of backward compatability. So join the new age and switch to STEVS.

  7. #7
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: Use IF statement in STDEV function?

    Quote Originally Posted by finalmike View Post
    isn't the STDEV more accurate in this case because you could have infinite replicates, so the population is actually larger than what I'm looking at?
    With the new information, yes.

    On the other hand, if by "replicates", you mean you have G5 #data with the value in H5, G6 #data with the value in H6 etc, you might need to calculate a weighted std dev. There is no Excel function to do that simply. And it's doubly complicated because you want to include data conditionally.
    Last edited by joeu2004; 08-18-2018 at 01:44 PM.

  8. #8
    Registered User
    Join Date
    12-28-2012
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2013
    Posts
    31

    Re: Use IF statement in STDEV function?

    I don't really understand when you would use STDEVP because I figure you can pretty much always have more replicates.

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,099

    Re: Use IF statement in STDEV function?

    Quote Originally Posted by finalmike View Post
    I don't really understand when you would use STDEVP because I figure you can pretty much always have more replicates.
    No... re-read post 3. If you are sampling an entire population ...

    also read here:

    https://statistics.laerd.com/statist...-deviation.php

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] STDEV IF function with multiple criteria
    By thaphthia in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-26-2021, 12:30 AM
  2. STDEV.P if statement
    By dave84x in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-24-2017, 01:13 PM
  3. Stdev / offset function to ignore #N/A
    By joshnathan in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-27-2014, 08:44 AM
  4. using stdev similar to the averageif function
    By DisplacedMic in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-22-2012, 08:52 AM
  5. How do I run the STDEV function with multiple criteria?
    By JLMcCracken in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-12-2006, 02:50 PM
  6. [SOLVED] Stdev function error!
    By Martin in forum Excel General
    Replies: 0
    Last Post: 04-26-2006, 02:10 AM
  7. STDEV function
    By robcunliffe in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-18-2005, 09:11 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1