Excel VBA | Average() Functions
VBA (Visual Basic for Applications) is the programming language of Excel and other offices. It is an event-driven programming language from Microsoft.
With Excel VBA, one can automate many tasks in excel and all other office softwares. It helps in generating reports, preparing various charts, graphs and moreover, it performs calculation using its various functions.
Let’s see Average functions in Excel.
- AVERAGE It returns the arithmetic mean of all of its arguments.
Syntax:
=AVERAGE(number1, number2, …)
Here,
number 1: This is the first number in your cell. You can specify it upto 255 numbers.
number 2: This is an Optional field. You can specify it upto 255 numbers.Example:

Output:

- AVERAGEIF: It calculates the average of only those values which meet a certain criteria.
Syntax:
=AVERAGEIF(range, criteria, average_range)
range: It is the range of cells to be evaluated. The cells in range can be numbers, names, arrays or any other reference that contains numbers. Blank and text values are not considered.
criteria: It should be in the form of a number or any expression which defines which all cells to be averaged. For instance, “mango”, C6, “<35”
average_range: [Optional] If this is not mentioned, Excel will get average of only those cells on which criteria is applied, which are specified in the range argument.
Notes:
-> If a cell in average_range is an empty cell, it will be ignored.
-> If range is a text value or blank, it will return an error.
-> If a cell in criteria is empty, it will be considered as 0 value.
-> If no cell meets the criteria, it will return an error.Example:

Output:

- AVERAGEIFS: Calculate average of cells that meet multiple criteria.
Syntax:=AVERAGEIFS(average_range, criteria_range1, criteria1, [criteria_range2, criteria2], …)
average_range: (Required) One or more cells to calculate average.
criteria_range1: (Required) 1 to 127 ranges to evaluate the given criteria.
criteria1: 1 to 127 criteria in the form of numbers, expression to be averaged. This defines which all cells in criteria_range1 are to be averaged. For instance, criteria can be like this, “>32”, “apple”, “D7”
Example:

Output:

Recommended Posts:
- Must use JavaScript Array Functions – Part 2
- Must use JavaScript Array Functions – Part 3
- Reading and Writing data to excel file using Apache POI
- Excel VBA | count() functions
- Activation functions in Neural Networks
- Higher Order Functions and Currying
- Creating a Cell at specific position in Excel file using Java
- Excel VBA | sum() functions
- Creating Sheets in Excel File in Java using Apache POI
- Background Subtraction in an Image using Concept of Running Average
- Is it okay to be an Average Student?
- Top 10 Useful GitHub Repos That Every Developer Should Follow
- 10 Interesting Facts About Computers
- Don't Let Your Geographical Location Be A Barrier In Your Success - Live Classes By GeeksforGeeks
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



