+ Reply to Thread
Results 1 to 12 of 12

excel newbie needs help, STDEV IF??

  1. #1
    Registered User
    Join Date
    02-14-2013
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    13

    excel newbie needs help, STDEV IF??

    I read through the forum but no success with my own excel sheet

    i have a large database i am looking at

    in COULMN B i have customer ID (there is multiple rows for each costumers)
    in COLUMN D i have true/false values (regarding whether someone bought something on the same day more than once, >1$)
    in COLUMN Q i have the amount the customer spent in each visit

    what I need to do is a formula for standard deviation of the spending... (col. Q) for each specific customer ID (Col B), if the value in column D is true.... but only to include those values in Q for which the corresponing D column is true,

    can anybody help?

    thanks in advance
    Last edited by alechkooo; 02-14-2013 at 02:20 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    11-02-2012
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    564

    Re: excel newbie needs help, STDEV IF??

    Something like this, assuming Col B is where you have True/False, Col C is the spent and formula is anywhere other than those 2 columns.
    Please Login or Register  to view this content.
    If you can upload your workbook, precise formula can be given.

  3. #3
    Registered User
    Join Date
    02-14-2013
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: excel newbie needs help, STDEV IF??

    Quote Originally Posted by haripopuri View Post
    Something like this, assuming Col B is where you have True/False, Col C is the spent and formula is anywhere other than those 2 columns.
    Please Login or Register  to view this content.
    If you can upload your workbook, precise formula can be given.
    here it is

    pretty much for each unique ID i need a stdev of the numbers spent correspending the TRUE value (excluding false values)..e.g i need a different stdev for each ID

    tryout.xlsx

    thanksagain

  4. #4
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: excel newbie needs help, STDEV IF??

    Try this array formula

    Please Login or Register  to view this content.
    Confirm with Ctrl+Shift+Enter and not just Enter

    Change the highlighted (in red) number for varying results based on Customer ID
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  5. #5
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: excel newbie needs help, STDEV IF??

    Try this array formula

    Please Login or Register  to view this content.
    Confirm with Ctrl+Shift+Enter and not just Enter

    Change the highlighted (in red) number for varying results based on Customer ID

  6. #6
    Registered User
    Join Date
    02-14-2013
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: excel newbie needs help, STDEV IF??

    hey thanks for the help but it doesn't really work well... issue is this...

    say I have 20,000 rows to apply this formula to.... I am trying to make it work automatically so I change whatever in red to "A1" and tried to re-apply it to all and it still doesnt work...

    any idea?

  7. #7
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: excel newbie needs help, STDEV IF??

    Maybe because I'm not real good at using these array formula IF's like others. When I need a conditional standard deviation, I tend to go back to my stats text and use the formulas given for standard deviation. The key one is the relation:

    sum((xi-mu)^2)=sum(x^2)-(sum(x))^2/n
    variance s^2=sum((xi-mu)^2)/(n-1)=(sum(x^2)-(sum(x))^2/n)/(n-1)
    stddev=sqrt(s^2)

    When I do this, I add two columns to my data -- one column will compute a series of 1's and 0's to identify which points are included in the statistic. This might look something like (comma delimited):
    Please Login or Register  to view this content.
    note that the -- in column c is called the unary operator and is used to convert a boolean value to 1 or 0.
    I do realize that I have not crammed everything into a single cell, and that I have not used the built in average and stdev functions -- I have only used sum(). Done correctly, this should be a robust spreadsheet for calculating averages and standard deviations of a subset of a larger set of data.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  8. #8
    Registered User
    Join Date
    02-14-2013
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: excel newbie needs help, STDEV IF??

    hmmm i dont get it :/

  9. #9
    Registered User
    Join Date
    02-14-2013
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: excel newbie needs help, STDEV IF??

    how do you put that into a formula/

  10. #10
    Registered User
    Join Date
    02-14-2013
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: excel newbie needs help, STDEV IF??

    I have tried this

    =STDEV(IF(AND(A:A=A1,B:B="TRUE"),C:C))

    or

    =IF(AND(A:A=A2,B:B=TRUE), STDEV(C:C,A:A=A2))

    but for some reason it doesn,t work..can anyone comment
    Last edited by alechkooo; 02-14-2013 at 07:04 PM.

  11. #11
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: excel newbie needs help, STDEV IF??

    hmmm i dont get it :/
    What part do you not understand? I'm not sure I'm in a position to give a full stats lecture on how to compute standard deviations, but I would expect any self-respecting intro to stats text to cover the topic adequately.

    how do you put that into a formula/
    As noted above, I'm not good at, neither am I fond of, putting these kind of array formulas together. I prefer to separate my computations out into several cells where each computation is more manageable for me. I'm sure someone here would be good enough to do it, or to help with the stdev(if()) array formulas that have been suggested.

    FWIW, I'm not sure why ACE_XL's suggested formula did not work for you, it seemed to work just fine for me. All you should need to do is adapt the ranges and the conditions to your specific situation/spreadsheet layout.

    Here's a sample spreadsheet that I put together.
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    02-14-2013
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: excel newbie needs help, STDEV IF??

    his formula did not work because it gives me a STDEV for all the values which have TRUE beside them together...(for all customers ID together)
    I am trying to figure a formula that will make different STDEV for each customer .... without having to change the ID number for each time i put in a formula (reason being is that the full database has 200 customer IDs or so )

+ 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