Estimate variance conditionally in Excel?

declan88

New Member
Joined
Apr 20, 2017
Messages
5
Hi All

I have two columns.
Column 1: categories 0-4
Column 2: various lengths of time
n=504

Could anyone tell me, how I can calculate the variance in time according to what ever category is picked, in Excel?

Thank you very much

Declan :)

PS This is my first post
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Re: How can I estimate variance conditionally in Excel?

Welcome to the forum.

I think this might help. I created some sample data and calculated the population variance per category. I used formulas here, but I also know a PivotTable would make quick work of the task.

The formulas in Column C are there to prove the formulas work in Column F. Column A is sorted according to category, but of course it doesn't need to be. Copy F2 downwards after it is properly invoked with Ctrl+Shift+Enter.

ABCDEF
1categoryminutesVariancecategoryVariance
2019026.00
3071480.89
401626.002330.67
5159362.67
6194471.84
7151480.89
8218
922
10246330.67
11342
12354
13341
14332
15346
1633162.67
17438
18456
19421
2042
21460471.84

<tbody>
</tbody>
Sheet6

Worksheet Formulas
CellFormula
C4=VARPA(B2:B4)

<tbody>
</tbody>

<tbody>
</tbody>

Array Formulas
CellFormula
F2{=VARPA(IF($A$2:$A$21=E2,$B$2:$B$21))}

<tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try to enter the {} manually yourself.

<tbody>
</tbody>
 
Last edited:
Upvote 0
Re: How can I estimate variance conditionally in Excel?

Thank you very much. An interesting approach with varpa. I shall test is out.
 
Upvote 0
Re: How can I estimate variance conditionally in Excel?

Thank you very much. An interesting approach with varpa. I shall test is out.

So I tried and found it didn't work.

Here as example.

Lets say I have a data set with 14 obs.
On the left I show how the data is represent in the table. On the right with the 0s deleted. Underneath this + and - 0s table, I will show the results of different forms of calc.

The different forms of calc of VAR show the 0s effect the outcomes of VAR (labelled simple VAR), VARPA, VARP and VARA.
If VAR -0s gives the correct result, none of the other formulas equal it.
Therefore my original questions remains outstanding:

Does anyone know a mechanism to calculate variance for a sample conditionally to exclude 0s (or blanks, text etc)

ObservationsObs minus 0s
0.2440.244
0.7020.702
0.5710.571
1.1201.120
0.000
0.000
0.2860.286
0.000
0.4290.429
0.000
0.000
0.2860.286
0.5710.571
0.000

<colgroup><col><col></colgroup><tbody>
</tbody>

With 0sWithout 0s
Mean (-0s)0.5260.526
Simple var0.1190.085
VARPA0.1100.074
VARP0.1130.063
VARA0.1120.095
{=VARPA(IF(…0.0740.074

<colgroup><col style="mso-width-source:userset;mso-width-alt:3612;width:76pt" width="102"> <col style="width:48pt" width="64" span="2"> </colgroup><tbody>
</tbody>

<colgroup><col><col span="2"></colgroup><tbody>
</tbody>

<colgroup><col><col></colgroup><tbody>
</tbody>


<colgroup><col><col span="2"></colgroup><tbody>
</tbody>
 
Upvote 0
Re: How can I estimate variance conditionally in Excel?

I worked it now.

The fomula for conditional variance is:
conditional STDEV^2

Viz

{=STDEV(IF(RANGE X1:Xn<>0;X1:Xn))*STDEV(IF(X1:Xn<>0; X1:Xn))} cntrl shift enter for curly brackets
or
{=(STDEV(IF(X1:Xn<>0; X1:Xn)))^2} cntrl shift enter for curly brackets
 
Upvote 0

Forum statistics

Threads
1,214,812
Messages
6,121,696
Members
449,048
Latest member
81jamesacct

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top