Results 1 to 12 of 12

Thread: Standard deviation of a subset in VBA

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #7
    snb
    Guest
    Subset 1 : A1:H1
    Subset 2 :A2:H2 , etc

    Sub M_snb()
        sn = Cells(1).CurrentRegion.Resize(, Cells(1).CurrentRegion.Columns.Count + 1)  
        For j = 1 To UBound(sn)
             For jj = 1 To UBound(sn, 2) - 1
                 sn(j, UBound(sn, 2)) = sn(j, UBound(sn, 2)) + sn(j, jj)
             Next
             sn(j, UBound(sn, 2)) = sn(j, UBound(sn, 2)) / (jj - 1)    
             x = 0
             n = 0
             For jj = 1 To UBound(sn, 2) - 1
                 If sn(j, jj) <> "" Then x = x + (sn(j, jj) - sn(j, UBound(sn, 2))) ^ 2
                 n = n + Abs(sn(j, jj) = "")
             Next
             y = y + Sqr(x / (jj - n - 2))
             c00 = c00 & vbLf & Sqr(x / (jj - n - 2))
        Next
        MsgBox c00 & vbLf & vbLf & y / UBound(sn)
    End Sub
    Last edited by Aussiebear; 02-22-2025 at 02:11 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •