I’m trying to get the Standard Deviations but in order for me to do this I need to skip over months that have a “false” or “zero” in the cell. I’m using a VBA Script to get my Standard Deviation, but if there is a better way, please let me know that also.
IIF Standard Deviations then skip that cell
VBA Script I’m using:
Thanks for taking the time to help
TCB
IIF Standard Deviations then skip that cell
Code:
SELECT Master_Join_tbl.[OMNI#], GetXLStDev([May_Pull_Thru],[June_Pull_thru],[July_Pull_thru],[Aug_Pull_Thru],[Sept_Pull_thru],[Oct_Pull_thru]) AS [Standard Deviations6M], Master_Join_tbl.May_Pull_Thru, Master_Join_tbl.June_Pull_Thru, Master_Join_tbl.July_Pull_Thru, Master_Join_tbl.Aug_Pull_Thru, Master_Join_tbl.Sept_Pull_Thru, Master_Join_tbl.Oct_Pull_Thru
FROM Master_Join_tbl;
VBA Script I’m using:
Code:
Public Function GetXLStDev(No1 As Double, No2 As Double, No3 As Double, No4 As Double, No5 As Double, No6 As Double) As Double
Dim objExcel As Object
Set objExcel = CreateObject("Excel.Application")
Let GetXLStDev = objExcel.StDev(No1, No2, No3, No4, No5, No6)
objExcel.Quit
Set objExcel = Nothing
End Function
Public Function Pause(PauseSeconds As Double)
Dim Start
Start = Timer
Do While Timer < Start + PauseSeconds
DoEvents
Loop
End Function
Thanks for taking the time to help
TCB