Google-sheets – Can Google Sheet’s =AVERAGE function count multiple values only once

google sheets

In Google Sheets, is it possible to count multiple values inside the =AVERAGE function only once?

Example:

=AVERAGE(32.3,48.9,33.2,48.9,33.5,49,33.8,49,33.5,48.5,48.8,33.9)

Count 33.5 only once.

Best Answer

You can use =UNIQUE for this, to remove duplicate values from a list of numbers. Note that =UNIQUE takes an array as parameter, not a list of numbers, so we need to wrap your list of numbers in {}:

=UNIQUE({32.3; 48.9; 33.2; 48.9; 33.5; 49; 33.8; 49; 33.5; 48.5; 48.8; 33.9})

This gives you a list of 9 elements - the duplicates have been removed:

32.3, 48.9, 33.2, 33.5, 49, 33.8, 48.5, 48.8, 33.9

Knowing this, we can combine the two formulas:

=AVERAGE(UNIQUE({32.3; 48.9; 33.2; 48.9; 33.5; 49; 33.8; 49; 33.5; 48.5; 48.8; 33.9}))

which gives the expected result of 40.21111111.


I have created a spreadsheet to demonstrate this, feel free to copy it. And see the documentation for =UNIQUE, =AVERAGE and Using arrays in Google Sheets.