# StephenRSuper Moderator

• Member since Feb 20th 2006
• Last Activity:
Posts
4,097
5
Points
20,750
Profile Hits
7,907
• Hii

i have an excel sheet and iam trying to get the weighted averages for the 4 parameters based on their date, if any one can solve my question it would help to my work. i need macros code for calculating weighted average.

upto now i did the simple average by using below code. can you modify this simple average code to weighted average code

Range("Q" & P + 7) = Round(WorksheetFunction.AverageIf(Range("A8:A" & lastRow_R), CDate(xCol2.Item(P)), Range("E8:E" & lastRow_R)), 2)

Range("R" & P + 7) = Round(WorksheetFunction.AverageIf(Range("A8:A" & lastRow_R), CDate(xCol2.Item(P)), Range("F8:F" & lastRow_R)), 2)

Range("S" & P + 7) = Round(WorksheetFunction.AverageIf(Range("A8:A" & lastRow_R), CDate(xCol2.Item(P)), Range("G8:G" & lastRow_R)), 2)

Here,
A Column indicates-Date
E,F&G Column Indicates- Parameters
C Column indicates -Weight for respected item
Q,R,S Column indicates - average results to be shown here

https://www.ozgrid.com/forum/i…post-list/339898-kiran66/

• Hi Stephen,

I read through your Macro code to convert list to 12x 8 grid in excel on the forum. It looks complicated for me to apply to the list of items I have in excel. I am looking for some very basic code where a list can be made into 12x 8 grid in another tab of excel. Can you help with this?

Thanks