I don't think you need a macro. I would try using a pivot table first.
Is there a reason that wouldn't work?
Pivot tables can sum/average/multiply/count
Regards,
Kelvin
Main Topics
Browse All TopicsHi,
I've an excel spreadsheet with
client name client type value_a value_b value_c
on a sheet called detailed
I've to create a summary sheet with
count average median std dev
value_a count_a average_a median_a stdev_a
value_b count_b average_b median_b stdev_b
value_c count_c average_c median_c stdev_c
total
where count_a =COUNT('Detailed'!D3:D163)
count_b =COUNT('Detailed'!E3:E163)
count_C =COUNT('Detailed'!F3:F163)
average_a =AVERAGE('Detailed'!D3:D16
average_B =AVERAGE('Detailed'!E3:E16
average_c =AVERAGE('Detailed'!f3:f16
median_a =MEDIAN('Detailed'!D3:D163
median_B =MEDIAN('Detailed'!E3:E163
median_c =MEDIAN('Detailed'!f3:f163
std dev_a =STDEV('Detailed '!D3:D163)
std dev_B =STDEV('Detailed '!E3:E163)
and so on
any ideas how I would write a macro to do this automatically
Any help would be much appreciated.
Regards,
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
sorted use dthe following and it worked fine:
Sub Format_Sheet()
'
' Macro5 Macro
' Macro recorded 26/05/2005 by linnanda
'
Dim myfile1 As String
Dim myfile2 As String
Dim myPath As String
Dim myname As String
myPath = "U:\transfer\a\Performance
myname = Dir(myPath, vbNormal) ' Retrieve the first entry.
Do While myname <> "" ' Start the loop.
If (GetAttr(myPath & myname) And vbNormal) = vbNormal Then
Workbooks.Open Filename:=myPath & myname
ActiveSheet.Name = "Detailed"
Sheets.Add
Sheets("Sheet1").Select
Cells.Select
With Selection.Interior
.ColorIndex = 2
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Range("A2").Select
ActiveCell.FormulaR1C1 = "Portfolio Manager:"
Range("A3").Select
ActiveCell.FormulaR1C1 = "Summary Performance by Client Type and Model"
Range("A4").Select
ActiveCell.FormulaR1C1 = "Quarter 3 2007"
Range("A2:A4").Select
Selection.Font.Bold = True
Range("A6:G6").Select
Selection.Borders(xlDiagon
Selection.Borders(xlDiagon
Selection.Borders(xlEdgeLe
With Selection.Borders(xlEdgeTo
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBo
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlEdgeRi
Selection.Borders(xlInside
With Selection.Interior
.ColorIndex = 15
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Range("D6").Select
ActiveCell.FormulaR1C1 = "All Clients"
Range("D6").Select
Selection.Font.Bold = True
Range("B7").Select
ActiveCell.FormulaR1C1 = "Model Portfolio"
Range("B7").Select
Selection.Font.Bold = True
Range("A2:A4").Select
Range("A4").Activate
With Selection.Font
.Name = "Arial"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("C7").Select
ActiveCell.FormulaR1C1 = "No. Clients"
Range("D7").Select
ActiveCell.FormulaR1C1 = "Perf Mean(%)"
Range("E7").Select
ActiveCell.FormulaR1C1 = "Perf Median(%)"
Range("F7").Select
ActiveCell.FormulaR1C1 = "Perf Std Dev"
Range("G6").Select
Selection.Borders(xlDiagon
Selection.Borders(xlDiagon
Selection.Borders(xlEdgeLe
Selection.Borders(xlEdgeTo
Selection.Borders(xlEdgeBo
Selection.Borders(xlEdgeRi
With Selection.Interior
.ColorIndex = 2
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Columns("B:F").Select
Columns("B:F").EntireColum
Range("B8").Select
ActiveCell.FormulaR1C1 = "Not defined"
Range("B9").Select
ActiveCell.FormulaR1C1 = "Capital Preservation"
Range("B10").Select
ActiveCell.FormulaR1C1 = "Current Income"
Range("B11").Select
ActiveCell.FormulaR1C1 = "Income + Growth"
Range("B12").Select
ActiveCell.FormulaR1C1 = "Long Term Growth"
Range("B13").Select
ActiveCell.FormulaR1C1 = "Capital Appreciation"
Range("B14").Select
ActiveCell.FormulaR1C1 = "Aggressive"
Range("B15").Select
ActiveCell.FormulaR1C1 = "No Predefined Benchmark"
Range("B16").Select
Columns("B:B").EntireColum
ActiveCell.FormulaR1C1 = "Total"
Range("B16").Select
With Selection
.HorizontalAlignment = xlRight
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
ActiveCell.FormulaR1C1 = " Total"
Range("A6:F16").Select
Range("A16").Activate
Selection.Borders(xlDiagon
Selection.Borders(xlDiagon
With Selection.Borders(xlEdgeLe
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTo
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBo
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRi
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlInside
Range("G25").Select
Columns("C:C").ColumnWidth
Columns("C:C").ColumnWidth
Columns("D:D").ColumnWidth
Columns("E:E").ColumnWidth
Columns("F:F").ColumnWidth
ActiveWindow.Zoom = 75
Range("B16").Select
Selection.Font.Bold = True
Range("A18:F18").Select
Selection.Borders(xlDiagon
Selection.Borders(xlDiagon
Selection.Borders(xlEdgeLe
With Selection.Borders(xlEdgeTo
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBo
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlEdgeRi
Selection.Borders(xlInside
With Selection.Interior
.ColorIndex = 15
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Range("D18").Select
ActiveCell.FormulaR1C1 = "Discretionary"
Range("D18").Select
Selection.Font.Bold = True
Range("B19").Select
ActiveCell.FormulaR1C1 = "Model Portfolio"
Range("B8").Select
ActiveCell.FormulaR1C1 = "Not Defined"
Range("B20").Select
ActiveCell.FormulaR1C1 = "Not Defined"
Range("B9:B16").Select
Selection.Copy
Range("B21").Select
ActiveSheet.Paste
Range("C7:F7").Select
Application.CutCopyMode = False
Selection.Copy
Range("C19").Select
ActiveSheet.Paste
Range("B19").Select
Selection.Font.Bold = True
Range("A18:F28").Select
Range("A28").Activate
Selection.Borders(xlDiagon
Selection.Borders(xlDiagon
With Selection.Borders(xlEdgeLe
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTo
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBo
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRi
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlInside
Range("A18:F28").Select
Selection.Copy
Range("A30").Select
ActiveSheet.Paste
Range("D30").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "Advisory"
Range("A30:F40").Select
Range("A40").Activate
Selection.Copy
ActiveWindow.SmallScroll Down:=10
Range("A42").Select
ActiveSheet.Paste
Range("D42").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "Execution"
Range("C43:F43").Select
Selection.Font.Bold = True
Range("C31:F31").Select
Selection.Font.Bold = True
Range("C19:F19").Select
Selection.Font.Bold = True
ActiveWindow.ScrollRow = 1
Range("C7:F7").Select
Selection.Font.Bold = True
Range("F7").Select
ActiveCell.FormulaR1C1 = "Perf Std Dev (%)"
Range("F19").Select
ActiveCell.FormulaR1C1 = "Perf Std Dev"
Range("F7").Select
Selection.Copy
Range("F19").Select
ActiveSheet.Paste
Range("F31").Select
ActiveSheet.Paste
Range("A2").Select
ActiveSheet.Name = "Summary"
'part 2
Range("A2").Select
Range("C8").Select
ActiveCell.FormulaR1C1 = "=COUNT(Detailed!C[4])"
Range("C9").Select
ActiveCell.FormulaR1C1 = "=COUNT(Detailed!C[5])"
Range("C10").Select
ActiveCell.FormulaR1C1 = "=COUNT(Detailed!C[6])"
Range("C11").Select
ActiveCell.FormulaR1C1 = "=COUNT(Detailed!C[7])"
Range("C12").Select
ActiveCell.FormulaR1C1 = "=COUNT(Detailed!C[8])"
Range("C13").Select
ActiveCell.FormulaR1C1 = "=COUNT(Detailed!C[9])"
Range("C14").Select
ActiveCell.FormulaR1C1 = "=COUNT(Detailed!C[10])"
Range("C15").Select
ActiveCell.FormulaR1C1 = "=COUNT(Detailed!C[11])"
Range("C16").Select
ActiveCell.FormulaR1C1 = "=COUNT(Detailed!C[4]:C[11
Range("D8").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Detailed!C[3])"
Range("D9").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Detailed!C[4])"
Range("D10").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Detailed!C[5])"
Range("D11").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Detailed!C[6])"
Range("D12").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Detailed!C[7])"
Range("D13").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Detailed!C[8])"
Range("D14").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Detailed!C[9])"
Range("D15").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Detailed!C[10])"
Range("E8").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Detailed!C[2])"
Range("E9").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Detailed!C[3])"
Range("E10").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Detailed!C[4])"
Range("E11").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Detailed!C[5])"
Range("E12").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Detailed!C[6])"
Range("E13").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Detailed!C[7])"
Range("E14").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Detailed!C[8])"
Range("E15").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Detailed!C[9])"
Range("F8").Select
ActiveCell.FormulaR1C1 = "=STDEV(Detailed!C[1])"
Range("F9").Select
ActiveCell.FormulaR1C1 = "=STDEV(Detailed!C[2])"
Range("F10").Select
ActiveCell.FormulaR1C1 = "=STDEV(Detailed!C[3])"
Range("F11").Select
ActiveCell.FormulaR1C1 = "=STDEV(Detailed!C[4])"
Range("F12").Select
ActiveCell.FormulaR1C1 = "=STDEV(Detailed!C[5])"
Range("F13").Select
ActiveCell.FormulaR1C1 = "=STDEV(Detailed!C[6])"
Range("F14").Select
ActiveCell.FormulaR1C1 = "=STDEV(Detailed!C[7])"
Range("F15").Select
ActiveCell.FormulaR1C1 = "=STDEV(Detailed!C[8])"
Range("D16").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Detailed!C[3]:C[
Range("E16").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Detailed!C[2]:C[9
Range("F16").Select
ActiveCell.FormulaR1C1 = "=STDEV(Detailed!C[1]:C[8]
Range("C8:F16").Select
Range("C16").Activate
Selection.NumberFormat = "#,##0;(#,##0)"
Range("C8:F16").Select
Range("C16").Activate
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
Range("A1").Select
Sheets("Detailed").Select
Rows("1:1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=5, Criteria1:="A"
Selection.AutoFilter Field:=5, Criteria1:="D"
Sheets("Summary").Select
ActiveCell.FormulaR1C1 = "=COUNT(Detailed!C[4])"
Range("C21").Select
Sheets("Summary").Select
Range("C20").Select
Sheets("Detailed").Select
Cells.Select
Selection.Copy
Sheets("Detailed").Select
Sheets.Add
ActiveSheet.Paste
Range("E7").Select
Sheets("Detailed").Select
Selection.AutoFilter Field:=5, Criteria1:="A"
Application.CutCopyMode = False
Selection.Copy
Sheets("Detailed").Select
Sheets.Add
ActiveSheet.Paste
Sheets("Detailed").Select
Selection.AutoFilter Field:=5, Criteria1:="E"
Application.CutCopyMode = False
Selection.Copy
Sheets("Detailed").Select
Sheets.Add
ActiveSheet.Paste
Range("D4").Select
Sheets("Summary").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("C20").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet2!C[4])"
Range("C21").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet2!C[5])"
Range("C22").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet2!C[6])"
Range("C23").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet2!C[7])"
Range("C24").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet2!C[8])"
Range("C25").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet2!C[9])"
Range("C26").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet2!C[10])"
Range("C27").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet2!C[11])"
Range("D20").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet2!C[3])"
Range("D21").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet2!C[4])"
Range("D22").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet2!C[5])"
Range("D23").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet2!C[6])"
Range("D24").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet2!C[7])"
Range("D25").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet2!C[8])"
Range("D26").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet2!C[9])"
Range("D27").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet2!C[10])"
Range("E20").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Sheet2!C[2])"
Range("E21").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Sheet2!C[3])"
Range("E22").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Sheet2!C[4])"
Range("E23").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Sheet2!C[5])"
Range("E24").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Sheet2!C[6])"
Range("E25").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Sheet2!C[7])"
Range("E26").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Sheet2!C[8])"
Range("E27").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Sheet2!C[9])"
Range("F20").Select
ActiveCell.FormulaR1C1 = "=STDEV(Sheet2!C[1])"
Range("F21").Select
ActiveCell.FormulaR1C1 = "=STDEV(Sheet2!C[2])"
Range("F22").Select
ActiveCell.FormulaR1C1 = "=STDEV(Sheet2!C[3])"
Range("F23").Select
ActiveCell.FormulaR1C1 = "=STDEV(Sheet2!C[4])"
Range("F24").Select
ActiveCell.FormulaR1C1 = "=STDEV(Sheet2!C[5])"
Range("F25").Select
ActiveCell.FormulaR1C1 = "=STDEV(Sheet2!C[6])"
Range("F26").Select
ActiveCell.FormulaR1C1 = "=STDEV(Sheet2!C[7])"
Range("F27").Select
ActiveCell.FormulaR1C1 = "=STDEV(Sheet2!C[8])"
Range("C28").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet2!C[4]:C[11])
Range("D28").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet2!C[3]:C[10
Range("E28").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Sheet2!C[2]:C[9])
Range("F28").Select
ActiveCell.FormulaR1C1 = "=STDEV(Sheet2!C[1]:C[8])"
Range("C20:F28").Select
Range("C28").Activate
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
Selection.NumberFormat = "#,##0;(#,##0)"
Range("F26").Select
ActiveWindow.SmallScroll Down:=17
Range("C32").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet3!C[4])"
Range("C33").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet3!C[5])"
Range("C34").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet3!C[6])"
Range("C35").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet3!C[7])"
Range("C36").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet3!C[8])"
Range("C37").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet3!C[9])"
Range("C38").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet3!C[10])"
Range("C39").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet3!C[11])"
Range("C32").Select
Sheets("Summary").Select
Range("D32").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet3!C[3])"
Range("D33").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet3!C[4])"
Range("D34").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet3!C[5])"
Range("D35").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet3!C[6])"
Range("D36").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet3!C[7])"
Range("D37").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet3!C[8])"
Range("D38").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet3!C[9])"
Range("D39").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet3!C[10])"
Range("E32").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Sheet3!C[2])"
Range("E33").Select
ActiveCell.FormulaR1C1 = ""
Range("E33").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Sheet3!C[3])"
Range("E34").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Sheet3!C[4])"
Range("E35").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Sheet3!C[5])"
Range("E36").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Sheet3!C[6])"
Range("E37").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Sheet3!C[7])"
Range("E38").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Sheet3!C[7])"
ActiveCell.FormulaR1C1 = "=MEDIAN(Sheet3!C[8])"
Range("E39").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Sheet3!C[9])"
Range("F32").Select
ActiveCell.FormulaR1C1 = "=STDEV(Sheet3!C[1])"
Range("F33").Select
ActiveCell.FormulaR1C1 = "=STDEV(Sheet4!C[2])"
Range("F32").Select
ActiveCell.FormulaR1C1 = "=STDEV(Sheet4!C[1])"
Range("F32").Select
Selection.ClearContents
Range("F33").Select
Selection.ClearContents
Range("F32").Select
ActiveCell.FormulaR1C1 = "=STDEV(Sheet4!C[1])"
ActiveCell.FormulaR1C1 = "=STDEV(Sheet3!C[1])"
Range("F33").Select
ActiveCell.FormulaR1C1 = "=STDEV(Sheet3!C[2])"
Range("F34").Select
ActiveCell.FormulaR1C1 = "=STDEV(Sheet3!C[3])"
Range("F35").Select
ActiveCell.FormulaR1C1 = "=STDEV(Sheet3!C[4])"
Range("F36").Select
ActiveCell.FormulaR1C1 = "=STDEV(Sheet3!C[5])"
Range("F37").Select
ActiveCell.FormulaR1C1 = "=STDEV(Sheet3!C[6])"
Range("F38").Select
ActiveCell.FormulaR1C1 = "=STDEV(Sheet3!C[7])"
Range("F39").Select
ActiveCell.FormulaR1C1 = "=STDEV(Sheet3!C[8])"
Range("C40").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet3!C[4]:C[11])
Range("D40").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(R[-1]C)"
ActiveCell.FormulaR1C1 = ""
Range("D40").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet3!C[3]:C[10
Range("E40").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Sheet3!C[2]:C[10]
Range("F40").Select
ActiveCell.FormulaR1C1 = "=STDEV(Sheet3!C[1]:C[8])"
Range("C32:F40").Select
Range("C40").Activate
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
Selection.NumberFormat = "#,##0;(#,##0)"
Range("C44").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet4!R[-42]C[4]:
Range("C45").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet4!R[-43]C[5]:
Range("C46").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet4!R[-44]C[7]:
Range("C47").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet4!R[-45]C[7]:
Range("C48").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet4!R[-46]C[8]:
Range("C49").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet4!R[-47]C[9]:
ActiveWindow.SmallScroll Down:=3
Range("C50").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet4!R[-48]C[10]
Range("C51").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet4!R[-49]C[11]
Range("D44").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet4!R[-42]C[3
Range("D45").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet4!R[-43]C[5
Range("D45").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet4!R[-43]C[4
Range("D46").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet4!R[-44]C[5
Range("D47").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet4!R[-45]C[6
Range("D48").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet4!R[-46]C[7
Range("D49").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet4!R[-47]C[8
Range("D50").Select
Sheets("Sheet3").Select
Range("M2:M17").Select
Range("M17").Activate
Sheets("Summary").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet4!R[-48]C[9
Range("D51").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet4!R[-49]C[1
Range("E44").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Sheet4!R[-42]C[2]
Range("E45").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Sheet4!R[-43]C[3]
Range("E46").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Sheet4!R[-44]C[4]
Range("E47").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Sheet4!R[-45]C[5]
Range("E48").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Sheet4!R[-46]C[6]
Range("E49").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Sheet4!C[7])"
Range("E50").Select
ActiveCell.FormulaR1C1 = ""
Range("E50").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Sheet4!C[8])"
Range("E51").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Sheet4!C[9])"
Range("E48").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Sheet4!C[6])"
Range("E47").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Sheet4!C[5])"
Range("E46").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Sheet4!C[4])"
Range("E45").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Sheet4!C[3])"
Range("E44").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Sheet4!C[2])"
Range("D44").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet4!C[3])"
Range("D45").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet4!C[4])"
Range("D46").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet4!C[5])"
Range("D47").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet4!C[6])"
Range("D48").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet4!C[7])"
Range("D49").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet4!C[8])"
Range("D50").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet4!C[9])"
Range("D51").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet4!C[10])"
Range("C44").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet4!C[4])"
Range("C45").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet4!C[5])"
Range("C46").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet4!C[7])"
Range("C47").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet4!C[7])"
Range("C48").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet4!C[8])"
Range("C49").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet4!C[9])"
Range("C50").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet4!C[10])"
Range("C51").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet4!C[11])"
Range("F44").Select
ActiveCell.FormulaR1C1 = "=STDEV(Sheet4!C[1])"
Range("F45").Select
ActiveCell.FormulaR1C1 = "=STDEV(Sheet4!C[2])"
Range("F46").Select
ActiveCell.FormulaR1C1 = "=STDEV(Sheet4!C[3])"
Range("F47").Select
ActiveCell.FormulaR1C1 = "=STDEV(Sheet4!C[3])"
Range("F47").Select
ActiveCell.FormulaR1C1 = "=STDEV(Sheet4!C[4])"
Range("F48").Select
ActiveCell.FormulaR1C1 = "=STDEV(Sheet4!C[5])"
Range("F49").Select
ActiveCell.FormulaR1C1 = "=STDEV(Sheet4!C[6])"
Range("F50").Select
ActiveCell.FormulaR1C1 = "=STDEV(Sheet4!C[7])"
Range("F51").Select
ActiveCell.FormulaR1C1 = "=STDEV(Sheet4!C[8])"
Range("C52").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet4!C[4]:C[11])
Range("D52").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet4!C[3]:C[10
Range("E52").Select
ActiveCell.FormulaR1C1 = "=MEDIAN(Sheet4!C[2]:C[9])
Range("F52").Select
ActiveCell.FormulaR1C1 = "=STDEV(Sheet4!C[1]:C[8])"
Range("C44:F52").Select
Range("C52").Activate
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
Selection.NumberFormat = "#,##0;(#,##0)"
Range("C52:F52").Select
Selection.Font.Bold = True
Range("C40:F40").Select
Selection.Font.Bold = True
Range("C28:F28").Select
Selection.Font.Bold = True
ActiveWindow.SmallScroll Down:=-11
Range("C16:F16").Select
Selection.Font.Bold = True
ActiveWindow.ScrollRow = 1
Range("A1").Select
ActiveWindow.SmallScroll Down:=21
Range("C46").Select
ActiveCell.FormulaR1C1 = "=COUNT(Sheet4!C[6])"
Range("F27").Select
ActiveWindow.ScrollRow = 21
ActiveWindow.LargeScroll Down:=-1
Range("A1").Select
Range("A1").Select
ActiveCell.FormulaR1C1 = ""
Range("B2").Select
Sheets("Detailed").Select
Selection.AutoFilter Field:=5
Rows("1:1").Select
Selection.AutoFilter
Range("A1").Select
ActiveWorkbook.Save
Sheets("Summary").Select
Range("A2").Select
Sheets("Detailed").Select
Sheets("Detailed").Move Before:=Sheets(2)
ActiveWindow.TabRatio = 0.203
Sheets("Summary").Select
ActiveWorkbook.Save
Range("A54").Select
ActiveCell.FormulaR1C1 = "Notes:"
Range("B54").Select
ActiveCell.FormulaR1C1 = "Mean: average performance"
Range("B55").Select
ActiveCell.FormulaR1C1 = "Median: middle performance value"
Range("B56").Select
ActiveCell.FormulaR1C1 = _
"Standard Deviation: average by which performance numbers differ from the mean, ignoring the sign of the difference."
Range("B57").Select
ActiveCell.FormulaR1C1 = "Report includes corrections made up to 16/10/07"
Range("B58").Select
ActiveCell.FormulaR1C1 = _
"Charts exclude any skewed performance numbers. Any such exclusions are detailed on the PMs detailed report in the last column"
Range("B59").Select
ActiveCell.FormulaR1C1 = _
"Chart details number of clients on the X axis and performance on the Y axis, broken out by models 4 and 5"
Range("A2").Select
'-------------------------
ActiveWorkbook.Save
ActiveWorkbook.Close
End If
myname = Dir() ' Get next entry.
Loop
End Sub
Business Accounts
Answer for Membership
by: aavictorPosted on 2007-10-16 at 09:24:52ID: 20086853
Missing size of matrix ed!B100000 )
population / sample size = countif(Detailed!B3:Detail