How to use the AVERAGEA function
What is the AVERAGEA function?
The AVERAGEA function returns the average of a group of values. Text and boolean value FALSE evaluates to 0. TRUE to 1. The "A" in AVERAGEA likely stands for "All" to indicate it averages all values after applying the text/logical conversions.
Table of Contents
1. Introduction
What is the average?
The average is a way to calculate central tendency which is the place of the center of a set of numbers in a statistical distribution. The most often used measures to calculate central tendency are:
- Average - arithmetic mean.
- Median - the middle number of a group of numbers.
- Mode - the most frequent item in a group
The average is the arithmetic mean.
What is arithmetic mean?
The arithmetic mean is calculated by dividing the sum of all values by the number of values.
For example, an array contains these values: 3,2,1
The sum is 3 + 2 + 1 equals 6
The number of values is 3.
6/3 equals 2. The average of 3, 2, 1 is 2
What are the differences between arithmetic mean, harmonic mean and geometric mean?
The arithmetic, harmonic, and geometric means are different ways to average data:
Arithmetic mean is calculated by summing values and dividing by count.
Harmonic mean is found by reciprocating values, averaging, then reciprocating.
Geometric mean is calculated by multiplying values and taking the nth root.
When to use:
- Arithmetic mean for typical or normally distributed data
- Harmonic mean for rates and ratios
- Geometric mean for percentages and proportional growth
The choice depends on data characteristics and what the average should represent. Arithmetic mean is most common, while harmonic and geometric means have specialized uses.
What are boolean values?
Boolean values are TRUE and FALSE. The numerical equivalent to TRUE is 1 and FALSE is 0 (zero). Boolean values are generated when a logical expression is evaluated, for example 1=1 returns TRUE where 1="A" returns FALSE.
What is the difference between AVERAGEA function and the AVERAGE function?
The AVERAGEA function includes logical values and text representations of numbers in a reference as part of the calculation.
For example, a cell range contains these vales: 3, FALSE,2, and 1
AVERAGE(3, FALSE,2, 1) returns 2.
3+2+1 = 6
6/3 = 2
AVERAGEA(3, FALSE,2, 1) returns 1.5.
3+0+2+1 = 6
6/4 = 1.5
The AVERAGEA function evaluates 1 for boolean value TRUE and 0 (zero) for FALSE. Text values and formulas that return nothing "" evaluate to 0 (zero).
This table shows the difference between AVERAGEA and AVERAGE functions.
Values | AVERAGEA | AVERAGE |
---|---|---|
Text values | 0 | Ignored |
Empty cells | Ignored | Ignored |
TRUE | 1 | Ignored |
FALSE | 0 | Ignored |
Related AVERAGEA functions
Function | Description |
---|---|
GEOMEAN(number1, [number2], ...) | Returns the geometric mean of values |
HARMEAN(number1, [number2], ...) | Returns the harmonic mean of values |
AVERAGE(number1, [number2], ...) | Returns the arithmetic mean of values |
AVERAGEA(value1, [value2], ...) | Returns arithmetic mean ignoring text |
AVERAGEIF(range, criteria, [average_range]) | Conditional arithmetic mean if criteria met |
AVERAGEIFS(average_range, criteria_range1, criteria1, ...) | Conditional arithmetic mean on multiple criteria |
2. AVERAGEA Function Syntax
AVERAGEA(value1, [value2], ...)
3. AVERAGEA Function Arguments
value1 | Required. Values for which you want to calculate the average. |
[value2] | Optional. Up to 254 additional arguments. |
4. AVERAGEA Function Example 1
This example has 5 values in cell range B3:B7 and they are: Text, 1, 2, TRUE, and FALSE. The reason these values are chosen is because it demonstrates how the AVERAGEA function handles text and boolean values before calculating the average.
Here is how they are processed by the AVERAGE function:
- Text - text strings are converted into a 0 (zero)
- 1 - numbers are not converted.
- 2 - see above.
- TRUE - Boolean value is converted in to number 1.
- FALSE - Boolean value is converted in to number 0. (zero)
This means that text and boolean value FALSE are counted to the total number of items but not added to the total as they are handled as 0's (zeros). However, numbers and boolean value TRUE are counted to the total number of items and added to the total.
Formula in cell D3:
The average formula is AVERAGE = "Sum of all numbers" / "Sum of all observations"
Here is how the calculation is performed in detail:
Value | Number |
Text | 0 |
1 | 1 |
2 | 2 |
TRUE | 1 |
FALSE | 0 |
Total number of items | Total: |
5 | 4 |
0 + 1 + 2 + 1 + 0 = 4/5 = 0.8
5. AVERAGEA Function Example 2
This example demonstrates how to calculate the average of a frequency table containing text values, boolean values and numbers. The image above displays the frequency table in cell range B3:C7 and in the table below.
Frequency | Values |
5 | Text |
3 | 1 |
7 | 2 |
2 | TRUE |
9 | FALSE |
The frequency means the number of times a given value exists in the observed data. For example, Text which is the first value in the frequency table exists 5 times, however, text values are considered 0's (zero). In other words, "Text" corresponds to five 0's in the observed data set.
The next two values are number 1 and 2, they are in the calculation as usual. Number 1 exists 3 times and number 2 exists 7 times based on the frequency table above.
The boolean value TRUE is equal to 1 and exists 2 times. FALSE is 0 (zero) and exists 9 times.
Formula in cell E3:
The AVERAGEA function is not built to handle frequency tables, the formula above is a workaround to handle these kind of calculations. The image above shows a frequency chart based on the frequency table above. It is a column chart with the values on the x-axis and the frequency on the y-axis.
Frequency | Values | Result |
5 | Text | 5 * 0 = 0 |
3 | 1 | 3 * 1 = 3 |
7 | 2 | 7 * 2 = 14 |
2 | TRUE | 2 * 1 = 2 |
9 | FALSE | 9 * 0= 0 |
The total is 0 + 3 + 14 + 2 + 0 = 19
The number of observations is 5 + 3 + 7 + 2 + 9 = 26
The average is 19 / 26 equals approx. 0.7307692
5.1 Explaining formula
Step 1 - Identify text values
The ISTEXT function returns TRUE if argument is text.
Function syntax: ISTEXT(value)
ISTEXT(C3:C7)
Step 2 - Convert text values to 0 and the leave the remaining values as is
The IF function returns one value if the logical test is TRUE and another value if the logical test is FALSE.
Function syntax: IF(logical_test, [value_if_true], [value_if_false])
IF(ISTEXT(C3:C7),0,C3:C7)
Step 3 - Multiply by frequency
The asterisk lets you multiply value to value, it lets you also multiply arrays by arrays.
IF(ISTEXT(C3:C7),0,C3:C7)*B3:B7
Step 4 - Sum numbers
The SUM function allows you to add numerical values, the function returns the sum in the cell it is entered in. The SUM function is cleverly designed to ignore text and boolean values, adding only numbers.
Function syntax: SUM(number1, [number2], ...)
SUM(IF(ISTEXT(C3:C7),0,C3:C7)*B3:B7)
Step 5 - Calculate ratio between the total and the number of observations
The division character lets you divide numbers, the ratio calculated here is the average based on the frequency table described above.
SUM(IF(ISTEXT(C3:C7),0,C3:C7)*B3:B7)/SUM(B3:B7)
Functions in 'Statistical' category
The AVERAGEA function function is one of 73 functions in the 'Statistical' category.
How to comment
How to add a formula to your comment
<code>Insert your formula here.</code>
Convert less than and larger than signs
Use html character entities instead of less than and larger than signs.
< becomes < and > becomes >
How to add VBA code to your comment
[vb 1="vbnet" language=","]
Put your VBA code here.
[/vb]
How to add a picture to your comment:
Upload picture to postimage.org or imgur
Paste image link to your comment.
Contact Oscar
You can contact me through this contact form