Using advnaced filter with sums and paste to table

Sayth

Board Regular
Joined
Jun 4, 2010
Messages
212
I am trying to create a table of calculated values on sheet3 from values on my Datasheet.

What my intention was is to filter the data on "Datasheet" by class. Count the number of members in each class(used to work out averages) and create a table for each class of final results variation from average etc on another sheet. In this workbook that sheet is call "SampleOut".

I have started on some code but not sure if I am even getting the base structure right. I have attached a spreadsheet.

Code:
[FONT=Arial][SIZE=2][COLOR=#000000]Sub Fomulas()

With Worksheets("Datasheet")

Dim ClassCount As Integer
Dim Anum, Bnum, Cnum, Dnum, Fnum As Long
Dim Aavg, Bavg, Cavg, Davg As Long

'       Filter by column B(Class id)
        .Range("B").AutoFilter Field:=1, Criteria1:="=1", Operator:=xlAnd
'        Using minus 1 to ensure headers aren't counted in Row Count 
        ClassCount = Cells(Rows.Count, "B").End(xlUp).Row - 1

FinalRow = Worksheets("Datasheet").Range(Cells("E:E"), Cells(LastRow, 5)).Cells
' Find the avg of all values in column and divide by number members
Aavg = (Sum("E2:E & FinalRow")) / ClassCount
' Find the difference for each member between their score and the average
Anum = ("E2:E & FinalRow") - Aavg
' Output values to sheet3

End With
End Sub[/COLOR][/SIZE][/FONT]</pre>

http://www.mediafire.com/file/o4eibshjd5lajon/SampleDataSheet.xlsm

This will basically be the final step in my project but I just don't have the experience to quite acheive this myself yet.
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Starting to do some research on it now thanks for the link. If I create a unique pivotable structure with multiple custom queries is there any easy way to house the pivotable structure so I can apply it to multiple datasheets that I open.
 
Upvote 0

Forum statistics

Threads
1,216,113
Messages
6,128,907
Members
449,478
Latest member
Davenil

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