Thursday 23 May 2013

Macro to calculate average of specified cell values in Excel

How to Calculate the average of certain cells in Excel

Example :
In below example, you will see how we can find out the average of given cell values.

Code and Syntax for calculating average in Excel VBA is given below.
You can find out the average in 2 ways.
  • Use Excel formula
  • Use VBA Excel Macro Code
 
 
By using formula
=AVERAGE(A1:A10)

By Using Excel Macro
 
Set myrange = Range("A1:A10")
Range("A11") = WorksheetFunction.Average(myrange)
This is how we can calculate average of given values in excel sheet using macro

No comments:

Post a Comment

Popular Posts

Search This Blog