Std Dev problem when using extra condition

epaklt

New Member
Joined
Jul 10, 2019
Messages
2
Hi,

I need to calculate the standard deviation for 'Duration' data, based on 2 conditions in multiple columns that both need to be TRUE. I had some trouble but ended up using the DSTDEV command. I want to be able to avoid getting an error when there is no data that meets these conditions. I have a cell that olds the count total (AM11). and this formula seems to give me the SD if I type this directly into the spreadsheet using the appropriate cells.

=IF((AM11>1),(DSTDEV($A$1:$AI$500,"Duration",$AK$20:$AL$21)),"Nil")

Range("AL11").Select
ActiveCell.FormulaR1C1 = _
"=IF((AM11>1),(DSTDEV(R1C1:R500C35,""Duration"",R20C37:R21C38)),""Nil"")"

However, when I run this from my macro, it inserts single quotes around AM11 and won't calculate. Below is what is seen in the spreadsheet. I have tried different variations but can't work out how to stop it from inserting the extra single quotes.

=IF('AM11'>1,(DSTDEV($A$1:$AI$500,"Duration",$AQ$20:$AR$21)),"Nil")

Any help would be appreciated.
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
have you tried writing your AM11 as R C format ?
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,021
Latest member
Mohamed Magdi Tawfiq Emam

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