STDEV from diferent date ranges. As if we were using AVERAGEIFS

mcva

New Member
Joined
Apr 20, 2020
Messages
28
Office Version
  1. 365
Platform
  1. Windows
Hi
I am trying to find a way to calculate the Standard Deviation similar to the AVERAGEIFS function.
The dates are in column P, i n the cell W is the year I want, and the actual values in column Q. I´m using the following approach:

{=STDEV(IF($P$2:$P$86,">="&DATE(W90,1,1),IF($P$2:$P$86,"<="&DATE(W90,12,31),Q2:Q86)))}

I´m getting #DIV/0!
I cant find a solution for this
Thank you
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
It looks like you're not finding any values to include. Check that your dates are actual dates and not text values. Make sure there's actually some values in your date range. You can use the Evaluate Formula tool to see if you're getting any values at all.
 
Upvote 0
It looks like you're not finding any values to include. Check that your dates are actual dates and not text values. Make sure there's actually some values in your date range. You can use the Evaluate Formula tool to see if you're getting any values at all.
Hi they are actual dates and there are actual values in the data range
 
Upvote 0
Sorry, I missed it on first glance. Your formula is in W16. The problem is that you have quote marks around your conditional, you only do that in a COUNTIF type formula. You could also shorten your formula to the W15 version, if you're always looking at the whole year. I'd also worry a bit that your date range has the absolute range reference ($), and the value range does not.

Book4
PQRSTUVW
31/1/20201
46/5/20202
52/2/20213
63/5/20214
77/8/20215
89/10/20216
93/2/20227
105/5/20228
11
12
13
14
151.290994
161.290994
89
902021
Sheet7
Cell Formulas
RangeFormula
W15W15=STDEV(IF(YEAR($P$2:$P$86)=W90,$Q$2:$Q$86))
W16W16=STDEV(IF($P$2:$P$86>=DATE(W90,1,1),IF($P$2:$P$86<=DATE(W90,12,31),Q2:Q86)))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Solution
Sorry, I missed it on first glance. Your formula is in W16. The problem is that you have quote marks around your conditional, you only do that in a COUNTIF type formula. You could also shorten your formula to the W15 version, if you're always looking at the whole year. I'd also worry a bit that your date range has the absolute range reference ($), and the value range does not.

Book4
PQRSTUVW
31/1/20201
46/5/20202
52/2/20213
63/5/20214
77/8/20215
89/10/20216
93/2/20227
105/5/20228
11
12
13
14
151.290994
161.290994
89
902021
Sheet7
Cell Formulas
RangeFormula
W15W15=STDEV(IF(YEAR($P$2:$P$86)=W90,$Q$2:$Q$86))
W16W16=STDEV(IF($P$2:$P$86>=DATE(W90,1,1),IF($P$2:$P$86<=DATE(W90,12,31),Q2:Q86)))
Press CTRL+SHIFT+ENTER to enter array formulas.
Your solution is perfect. Thank you
 
Upvote 0

Forum statistics

Threads
1,214,935
Messages
6,122,337
Members
449,077
Latest member
Jocksteriom

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