简体   繁体   中英

Using excel, how do you calculate the average occurrence of the same numbers in a column?

For example:

[Column A] 1,1,2,2,3,3,3 = The average is 2.3

[Column B] 2,2,3,3,4,4 = the average is 2 (each number appears 2 times each)

[Column C] 2,2,2,3,3,3,4,4,4 = the average is 3 (each number appears 3 times each)

With array formula it will be simpler:

=COUNT(A$1:A$10)/SUM(IF(A$1:A$10<>"",1/(COUNTIF(A$1:A$10,A$1:A$10))))

Array formula after editing is confirmed by pressing ctrl + shift + enter

在此处输入图像描述

=(ROWS(A1:A9)-COUNTBLANK(A1:A9))/SUMPRODUCT(1/COUNTIF(OFFSET(A1,,,COUNTA(A1:A9));OFFSET(A1,,,COUNTA(A1:A9))))

The lenght of the different columns makes it a bit tricky though(hence using OFFSET and COUNTA).

在此处输入图像描述

Another option (with blank cells support):

=AVERAGE(COUNTIF(C5:C13,UNIQUE(C5:INDIRECT(ADDRESS(COUNTA(C5:C13)+ROW(C4),COLUMN(C4))))))

Output (French software, O365):

数数

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM