+ Reply to Thread
Results 1 to 19 of 19

STDEV multiple criteria

Hybrid View

  1. #1
    Registered User
    Join Date
    04-11-2017
    Location
    Utrecht, The Netherlands
    MS-Off Ver
    2010
    Posts
    7

    STDEV multiple criteria

    Hi all,

    I have a question related to calculating the STDEV of daily returns with multiple criteria. The data in the spreadsheet is sorted on firm id and year. I have multiple firms and multiple years in my spread sheet. Which formula should I use to for example calculate the STDEV of Firm XYZ in Year 2006?

    I have tried using: =STDEV(IF((firm_id range=firm id)*(year range=year); value range; "")) and used ctrl+shift+enter, but it does not seem to work.

    Can anyone help me with this issue?

    Thanks a lot in advance!

    Kind regards,
    Nicole

  2. #2
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,366

    Re: STDEV multiple criteria

    Try Array

    =STDEV(IF(firm_id range=firm id;IF(year range=year;value range)))
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

  3. #3
    Registered User
    Join Date
    04-11-2017
    Location
    Utrecht, The Netherlands
    MS-Off Ver
    2010
    Posts
    7

    Re: STDEV multiple criteria

    Hi Vlady,

    Thanks a lot for your reply.

    It does not seem to work when I use the formula: =STDEV(IF('1004'!$A$2:$A$2266=[@GVKEY];IF('1004'!$C$2:$C$2266=[@Year2];'1004'!$E$3:$E$2266))) and press ctrl+shift+enter.
    I get #DIV/0!

    It somehow also seems weird to me to put a second IF statement in the "value if true" argument.

  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 2406
    Posts
    44,662

    Re: STDEV multiple criteria

    Don't you mean:

    =STDEV(IF('1004'!$A$2:$A$2266=[@GVKEY];IF('1004'!$C$2:$C$2266=[@Year2];'1004'!$E$2:$E$2266)))
    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
    04-11-2017
    Location
    Utrecht, The Netherlands
    MS-Off Ver
    2010
    Posts
    7

    Re: STDEV multiple criteria

    Hi Glen,
    On E3 the return calculation starts (ln(D3)-ln(D2)), so it should be E3 I think

  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 2406
    Posts
    44,662

    Re: STDEV multiple criteria

    Quote Originally Posted by Nicole2017 View Post
    Hi Glen,
    On E3 the return calculation starts (ln(D3)-ln(D2)), so it should be E3 I think
    Whatever else may be wrong with your data... you DO need to have all three ranges covering the same number of rows. However, as I've already requested, please post a sample sheet.

  7. #7
    Forum Expert
    Join Date
    12-03-2009
    Location
    Florence, Italy
    MS-Off Ver
    Excel 2019
    Posts
    1,796

    Re: STDEV multiple criteria

    Hi All,

    you could try

    STDEV.S

    or you try to add an extra segment

    IF('1004'!$E$2:$E$2266<>""...

    Hope it helps

    Edit: sorry Glenn Kennedy. I had not seen your post.
    Last edited by canapone; 04-12-2017 at 04:07 AM. Reason: ...typo
    -----------------------------------------------------

    At Excelforum, you can say "Thank you!" by clicking the star icon ("Add Reputation") below the post.

    Please, mark your thread [SOLVED] if you received your answer.

  8. #8
    Registered User
    Join Date
    04-11-2017
    Location
    Utrecht, The Netherlands
    MS-Off Ver
    2010
    Posts
    7

    Re: STDEV multiple criteria

    Hi canapone,

    When I use the stdev.s formula I also get #div/0!.

    I don't really understand how I should add an extra segment though.

  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 2406
    Posts
    44,662

    Re: STDEV multiple criteria

    The ranges need to be the same. however, i suspect your problem lies elsewhere..

    Will you please attach a SMALL sample Excel workbook (10-20 rows of data is usually enough)? Please don't attach a picture of one (no-one will want to re-type all your stuff before starting).

    1. Make sure that your sample data are truly REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential information is removed first!!

    4. Try to avoid using merged cells. They cause lots of problems!

    Unfortunately the attachment icon doesn't work at the moment. So, to attach an Excel file you have to do the following: Just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

  10. #10
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: STDEV multiple criteria

    try: =STDEV(--(firm_id range=firm id)*--(year range=year)*value range) and CSE

    something like: {=STDEV(--(B2:B10="a")*--(C2:C10>5)*D2:D10)}

    btw. ranges should be the same size or you get N/A

    repsolv.gif
    Last edited by sandy666; 04-12-2017 at 05:07 AM.

  11. #11
    Registered User
    Join Date
    04-11-2017
    Location
    Utrecht, The Netherlands
    MS-Off Ver
    2010
    Posts
    7

    Re: STDEV multiple criteria

    Attachment
    Attached Files Attached Files

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

    Re: STDEV multiple criteria

    Your data in columns A & C are text that look like numbers:

    =STDEV(IF(--$A$3:$A$17=G3,IF(--$C$3:$C$17=I3,$E$3:$E$17)))

    array entered.

  13. #13
    Registered User
    Join Date
    04-11-2017
    Location
    Utrecht, The Netherlands
    MS-Off Ver
    2010
    Posts
    7

    Re: STDEV multiple criteria

    Hi Glenn,
    The formula worked, thank you!!

    EDIT: In my full sheet it doesn't work, but I'll try to figure out what's wrong there. Should be a data issue then probably
    Last edited by Nicole2017; 04-12-2017 at 05:34 AM.

  14. #14
    Registered User
    Join Date
    04-11-2017
    Location
    Utrecht, The Netherlands
    MS-Off Ver
    2010
    Posts
    7

    Re: STDEV multiple criteria

    It worked now Thanks a lot everyone. Saves me a lot of manual work!

  15. #15
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: STDEV multiple criteria

    change values in A and C columns to numbers not text and it will work
    Values in G col and I col are numbers

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

    Re: STDEV multiple criteria

    You're welcome.

  17. #17
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: STDEV multiple criteria

    with your example: =STDEV((--Tabel3[Standard and Poor''s Identifier]=[GVKEY])*(--Tabel3[Year]=[[VolatilityYear ]])*(Tabel3[Return])) and CSE

  18. #18
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: STDEV multiple criteria

    You are welcome

    00repsolv.gif

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

    Re: STDEV multiple criteria

    Glad it worked for you... eventually..



    If that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.

+ 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. [SOLVED] Median StDEV IF Wildcards Multiple Criteria within Dates
    By almugs in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 01-28-2016, 02:11 PM
  3. Replies: 10
    Last Post: 09-15-2014, 09:48 AM
  4. Replies: 2
    Last Post: 04-24-2012, 10:36 AM
  5. STDEV with Mulitple Criteria Part 2
    By RJS5062 in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 03-23-2012, 04:06 PM
  6. STDEV with Mulitple Criteria
    By RJS5062 in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 03-23-2012, 12:55 PM
  7. 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

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