# Calculating stdev.s excluding a certain value

#### droot

##### New Member
Hi,

I'm trying to calculate the stdev.s of a dataset that isn't 26.

This is the formula I'm using - {=STDEV.S(IF(Sheet1!V:V<>"26",Sheet1!V:V))} and it gives me 8.3
If i calculate the same data set but remove all the 26's using find and replace, i get 18.9

What am I doing wrong?

### Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Maybe:

{=STDEVA(IF(V2:V100<>26,V2:V100))}

Last edited by a moderator:
That gives the same result as the first (8.3)

Sorry, just seen the edit. I think it worked!! Testing on other datasets to makes sure

An important factor that might be overlooked: certainly the range V:V, and perhaps even the range V2:V100, will include unintended zero values in the calculation. This is because when the "value if true" range is evaluated, any empty cells are treated as zero, unlike a straight-forward STDEV(V2:V100) expression.

To demonstrate, enter 1, 2, 3 and 4 into alternating cells A1, A3, A5 and A7. Note the difference between =STDEV(A1:A7) and array-entered { =STDEV(IF(A1:A7<>26,A1:A7)) }. Now, enter zero into A2, A4 and A6. Note that STDEV(A1:A7) now returns the same result as the array-entered formula.

If you want to ignore empty cells as well as cells that equal 26, array-enter the following:

{ =IF(STDEV(IF(Sheet1!V2:V100<>"", IF(Sheet1!V2:V100<>26, Sheet1!V2:V100))) }

I cannot see any reason to use STDEVA instead of STDEV. On the contrary, STDEVA might give an unintended result in the cases that make the two functions different.

The important take-aways are: use limited ranges (V2:V100) instead of whole-column ranges (V:V); and do not put quotes around numbers ("26") that are intended to be treated as such.

Thank you both for your help.
@joeu2004 - thanks for the explanation, very helpful.

Replies
4
Views
1K
Replies
2
Views
231
Replies
4
Views
478
Replies
2
Views
337
Replies
4
Views
267

1,217,346
Messages
6,136,044
Members
449,981
Latest member
kjd513

### 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.

### Which adblocker are you using?

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

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