STDEV.P in dynamic range

sbv1986

Board Regular
Joined
Nov 2, 2017
Messages
87
Hi All

I have data in range(Cells(3,"H"),Cells(lrow,lcol))
lrow = lastrow in range
lcol = last columns in range
Now I want to have macro fill fomula in G3 = STDEV.P(range(Cells(3,"G"),Cells(3,lcol))
And then fill down to last row

Please help me, thanks in advance.
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
But that formula refers to the cell containing the formula?
 
Upvote 0
But that formula refers to the cell containing the formula?
I've just find this medthod like this code belove

VBA Code:
sub STDEV()
dim lrow, lcol as long
With sheets1
    lRow = .Cells(Rows.Count, 13).End(xlUp).Row 'Last row Column M=20
    lCol = .Cells(1, Columns.Count).End(xlToLeft).Column 'Last column in row 1
    If lCol < 14 Then lCol = 14
        .Range(.Cells(2, "N"), .Cells(lRow, lCol)).Clear
        .Range("I3:L" & lRow).Clear
    .Columns("D:H").ClearContents
    .Columns("M").ClearContents
    .Range("H1:M1").Value = Array("CONFIDENCE", "SUM", "MAX", "MIN", "Average", "STDEV.P")
    .Range("I3:I" & lRow).FormulaR1C1 = "=round(Sum(RC14:RC" & lCol & "),0)"
    .Range("J3:J" & lRow).FormulaR1C1 = "=max(RC14:RC" & lCol & ")"
    .Range("K3:K" & lRow).FormulaR1C1 = "=min(RC14:RC" & lCol & ")"
    .Range("L3:L" & lRow).FormulaR1C1 = "=iferror(AVERAGE(RC14:RC" & lCol & "),0)"
    .Range("M3:M" & lRow).FormulaR1C1 = "=round(STDEV.P(RC14:RC" & lCol & "),0)"
    .Range("H3:H" & lRow).FormulaR1C1 = "=round(CONFIDENCE(0.05,RC13," & lCol - 13 & "),0)"
    .Range("H2", .Cells(lRow, lCol)).Value = .Range("H2", .Cells(lRow, lCol)).Value
    .Range("H2", .Cells(lRow, lCol)).NumberFormat = "#,##0"
    .Rows(1).Font.Bold = True
    With .UsedRange.Borders  '.Range(.Cells(1, 1), .Cells(lRow, lCol - 5)).Borders
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
End With
End sub
 
Upvote 0

Forum statistics

Threads
1,215,734
Messages
6,126,542
Members
449,316
Latest member
sravya

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