+ Reply to Thread
Results 1 to 6 of 6

For StDev function omit data in range from the calculation that is greater than a number

Hybrid View

  1. #1
    Registered User
    Join Date
    10-03-2011
    Location
    Miami/Fort Lauderdale, Fl., USA
    MS-Off Ver
    Excel 2007
    Posts
    28

    For StDev function omit data in range from the calculation that is greater than a number

    I want to do a standard deviation calculation that omits any numbers from the calculation that are greater than (or less than) the number in a specific cell. I have a macro to create a StDevIf function that will only use the numbers that match that criteria in the same row, but I am not sure how to modify it so that I can use a greater than (or less than) cell reference as the criteria (see code below). Also is there any way to add a new function that can be used in non-macro enabled workbooks? Thank you for your help in advance.

    HTML Code: 

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: For StDev function omit data in range from the calculation that is greater than a numb

    If I understand what you want this can be done with an array formula**.

    Something like...

    X1 = set value

    =STDEV(IF(A1:A10>X1,A1:A10))

    =STDEV(IF(A1:A10<X1,A1:A10))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    10-03-2011
    Location
    Miami/Fort Lauderdale, Fl., USA
    MS-Off Ver
    Excel 2007
    Posts
    28

    Re: For StDev function omit data in range from the calculation that is greater than a numb

    Hi Tony,

    This worked {=STDEV(IF(B7:B39<=B2,B7:B39))}, but when I added in an AND function I ran into problems {=STDEV(IF(AND(B7:B39<=B2,B7:B39>=B3),B7:B39))}. What am I doing wrong? This is Excel 2007.

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: For StDev function omit data in range from the calculation that is greater than a numb

    Try it like this...

    =STDEV(IF(B7:B39<=B2,IF(B7:B39>=B3,B7:B39)))

    Still array entered.

  5. #5
    Registered User
    Join Date
    10-03-2011
    Location
    Miami/Fort Lauderdale, Fl., USA
    MS-Off Ver
    Excel 2007
    Posts
    28

    Re: For StDev function omit data in range from the calculation that is greater than a numb

    Ok got it to work: {=STDEV(IF(B7:B39>=B3,IF(B7:B39<=B2,B7:B39)))}

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: For StDev function omit data in range from the calculation that is greater than a numb

    Good deal. Thanks for the feedback!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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