简体   繁体   English

如何在 Excel 中计算平均值 ID

[英]How to calculate averages IDs in Excel

I have the following data我有以下数据

A   B
ID  Time
22  00:20
33  00:30
60  01:30
41  00:20
41  00:30
33  01:00
22  01:00

Column A= Id and column B= Time A列= ID,B列=时间

I want to calculate the average time for IDs and get the following table in Excel我想计算 ID 的平均时间并在 Excel 中获得下表

I struggled to do it我努力做到了

C   D
ID  Time
22  40
33  45
60  90
41  25

在此处输入图片说明

Make sure you are using the right formula and have the number format as general.确保您使用的是正确的公式,并且数字格式与常规一样。

If you have the unique IDs in column C, and want the average on column D, and row 1 has the titles, you could use this formula in cell D2:如果您在 C 列中有唯一 ID,并且想要 D 列上的平均值,并且第 1 行有标题,则可以在单元格 D2 中使用此公式:

=averageifs(b$1:b$1000, a$1:a$1000, d2) =averageifs(b$1:b$1000, a$1:a$1000,d2)

It means "Average the number in column B if what is in column A matches D2".这意味着“如果 A 列中的内容与 D2 匹配,则对 B 列中的数字求平均值”。

Fill down the formula.填写公式。

Then select column D, press Ctrl-1 (with the numbers on top of the letters) to go to format, and in "General" type [mm].然后选择 D 列,按 Ctrl-1(数字在字母上方)转到格式,然后在“常规”中输入 [mm]。

AVERAGEIF is enough: AVERAGEIF就足够了:

=AVERAGEIF(A:A;D2;B:B)

在此处输入图片说明

Cell format [mm]单元格格式[mm]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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