+ Reply to Thread
Results 1 to 5 of 5

Using DVAR

  1. #1
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Berlin/Sweden
    MS-Off Ver
    Excel 2010
    Posts
    124

    Using DVAR

    Hey guys,

    I need to calculate the variance from a large data set but I just can't get the DVAR to work. I can do it "per critera" manually using the VAR function but since I have many criteria I need to automatize it.

    attached is sample data.

    Thanks!
    Attached Files Attached Files

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Using DVAR

    How about instead ...

    E
    F
    G
    2
    Critera
    VAR
    3
    A
    1128.7
    F3: {=VAR(IF($A$2:$A$360=E3, $B$2:$B$360))}
    4
    B
    339.4
    5
    C
    627.7
    6
    D
    1713.7
    7
    E
    1295.2
    8
    F
    1116.2
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Berlin/Sweden
    MS-Off Ver
    Excel 2010
    Posts
    124

    Re: Using DVAR

    Ah well that is also a good solution! I will use it thanks!

    But out of curiosity it would be interesting know how the dvar function works if anybody knows.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Using DVAR

    You're welcome.

  5. #5
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Using DVAR

    Hi,

    For an arrangement such as yours I would suggest using formula criteria with D-functions thus
    Excel 2016 (Windows) 64 bit
    E
    F
    G
    H
    2
    Criteria VAR DVAR Formula Criteria
    3
    A
    =VAR(B2:B21)
    =DVAR($A$1:$B$360,2,H2:H3)
    =A2=$E$3
    4
    B
    =VAR(B22:B37)
    =DVAR($A$1:$B$360,2,H3:H4)
    =A2=$E$4
    5
    C
    =VAR(B38:B64)
    =DVAR($A$1:$B$360,2,H4:H5)
    =A2=$E$5
    6
    D
    =VAR(B65:B109)
    =DVAR($A$1:$B$360,2,H5:H6)
    =A2=$E$6
    7
    E
    =VAR(B66:B109)
    =DVAR($A$1:$B$360,2,H6:H7)
    =A2=$E$7
    8
    F
    =VAR(B213:B360)
    =DVAR($A$1:$B$360,2,H7:H8)
    =A2=$E$8


    which will produce the following results
    Excel 2016 (Windows) 64 bit
    E
    F
    G
    H
    2
    Criteria VAR DVAR Formula Criteria
    3
    A
    1129
    1129
    TRUE
    4
    B
    339
    339
    FALSE
    5
    C
    628
    628
    FALSE
    6
    D
    1714
    1714
    FALSE
    7
    E
    1752
    1295
    FALSE
    8
    F
    1116
    1116
    FALSE


    Note that your existing calculation for E is incorrect as it is looking at the wrong range.

    Alternatively, you might use a one-variable data table thus
    Excel 2016 (Windows) 64 bit
    E
    F
    G
    H
    2
    =DVAR($A$1:$B$360,2,H2:H3)
    Criteria
    3
    A
    =TABLE(,H3)
    A
    4
    B
    =TABLE(,H3)
    5
    C
    =TABLE(,H3)
    6
    D
    =TABLE(,H3)
    7
    E
    =TABLE(,H3)
    8
    F
    =TABLE(,H3)


    to produce the same results
    Excel 2016 (Windows) 64 bit
    E
    F
    G
    H
    2
    1129
    Criteria
    3
    A
    1129
    A
    4
    B
    339
    5
    C
    628
    6
    D
    1714
    7
    E
    1295
    8
    F
    1116
    Last edited by xlnitwit; 01-06-2017 at 01:04 PM.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

+ 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