calculate standard deviation given criteria and empty cells

newfie675

New Member
Joined
Mar 16, 2020
Messages
2
Office Version
  1. 2019
Platform
  1. MacOS
Hi, I have a spreadsheet that multiple users will be pasting data into and depending on the analytical company it will vary from blank (no analysis) or <value (below detection limits) or >value (above detection limits). I am trying to calculate the standard deviation of an array with specific criteria and the cell has a numerical value.

For example I have a spreadsheet that contains: column A with Company X and Company Y, Column B with numerical data, blank cells and text value (e.g. <0.03 or >10000).
I am using Shift+Ctrl+Enter to get the {}
If I calculate the standard deviation of Company X by sorting Column A and Column B =STDEV(B2:B9) I get a value of 10 which is the correct value
I have tried {=STDEV(IF(AND(A2:A21="Company X",B2:B21<>0),B2:B21))} I get a Standard deviation of #DIV/0!
I have tried {=STDEV(A2:A21="Company X"),B2:B21)} I get a Standard deviation of 251 which calculates blank and text cells as 0
If I use {=STDEV(IF(A2:A21="Company Y",B2:B21))} that does not have blanks or text the standard deviation is calculated correctly

Any help would be greatly appreciated.
Thanks
 

Attachments

  • Screen Shot 2020-03-16 at 11.11.52 AM.png
    Screen Shot 2020-03-16 at 11.11.52 AM.png
    33.8 KB · Views: 79

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Array-enter the following formula:

=STDEV(IF(A2:A21="Company X",IF(B2:B21<>0, B2:B21)))

We cannot use functions like AND and OR in array-entered formulas because they process the entire array/range parameter, instead of evaluating row-by-row, as you intend. In other words, AND(A2:A21="X",...) is equivalent to AND(A2="X",A3="X",...,A21="X",...).

FYI, I get 11.1066260789289 for Company X, which rounds to 11, not 10. But that might be because the values in column B are not actually the integers that you display. Right?

I get 15.7247530073721 for Company Y, which does round to 16.

I hope you know that the text "<15" is ignored by STDEV.
 
Upvote 0
Thank you so much that does work.
For Company X I had 1 blank cell in the formula by mistake. That is why I was getting 10 and not 11. Removing the blank cell I get 11 as well.
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,219
Members
452,619
Latest member
Shiv1198

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