Get the Average Standard Deviation from a Dynamic Dataset

TheGallows32

New Member
Joined
Feb 16, 2018
Messages
11
Hi everyone! Is this possible in Excel??

Let's say I have 10 rows of numerical data across 10 columns, and I'd like to find the Standard Deviation of the numbers across each row.
In the end I would have 10 standard deviations (one for each row) that I could then average.

Simple enough if you're dealing with a static worksheet, but in my workbook I'm dynamically grabbing different samples of data using drop-down list input fields and the OFFSET, INDIRECT, and VLOOKUP functions.

Could I get the job done with a CSE function?


Thanks!
-J
 
I am not quite sure what you are asking, but looking at you image it would appear that you want to iterate from row 942 to 948 across columns C to E ( 3 to 5) on the worksheet “Data”. Also it would appear that the values you want to iterate across are held in cells I16 to I19 on the sheet “Backend”. This code does this which I hope is what you want, it does show you how to cope with a "dynamic" range to be calculated using the cells I 16 to 19 to determine the start and end point.
You didn't say where you wanted the results, so I am still writing it out to cells(13,1) on the active sheet.
Code:
Sub test()
Dim stdev As Variant
Dim temparr As Variant
With Worksheets("Backend")
 rowcol = Range(.Cells(16, 9), .Cells(19, 9))
End With
numberofrows = rowcol(3, 1) - rowcol(1, 1)
numberofcols = rowcol(4, 1) - rowcol(2, 1)
ReDim stdevarr(0 To numberofrows, 1 To 1) As Variant
ReDim tempar(0 To numberofcols) As Variant


With Worksheets("Data")
inarr = .UsedRange.Value
End With
For i = rowcol(1, 1) To rowcol(3, 1)
 For j = rowcol(2, 1) To rowcol(4, 1)
  tempar(j - rowcol(2, 1)) = inarr(i, j)
 Next j
 stdevarr(i - rowcol(1, 1), 1) = Application.WorksheetFunction.stdev(tempar)
Next i
averagev = Application.WorksheetFunction.Average(stdevarr)
Cells(13, 1) = averagev
End Sub
 
Last edited:
Upvote 0

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
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