Excel Pivot Table:如何根据日期时间值计算员工的工作天数?
Excel Pivot Table: How do I count the number of working days for employees based on date-time values?
在我的理论数据集中,我有一个显示销售日期时间的列表,以及完成交易的员工。
我知道如何进行分组以显示每位员工每天的销售额,但我想知道是否有一种方法可以计算有多少天的销售额超过 0。
例如,这里是原始数据集:
Employee | Order Time
A | 8/12 8:00
B | 8/12 9:00
A | 8/12 10:00
A | 8/12 14:00
B | 8/13 10:00
B | 8/13 11:00
A | 8/13 15:00
A | 8/14 12:00
这是我创建的枢轴 table:
Employee | 8/12 | 8/13 | 8/14
A | 3 | 1 | 1
B | 1 | 2 | 0
这是我想知道的:
Employee | Working Days
A | 3
B | 2
将您的订单时间列(假定为 B
)分成两部分,例如使用文本到列和 Space 作为分隔符(可能需要稍作调整)。然后如图所示进行透视(使用数据模型):
并对结果(在 PT 之外)求和,例如:
=SUM(F3:H3)
复制下来以适应。
列 F:G 可能会被隐藏。
我完全支持@Andrea 对上述内容的评论(更正):
I think this could have been made simpler. If you remove the "Time" in values of the pivot table and then move "Order" from columns to values and use distinct count as in the example. It should count Employee per date making the sum not needed. If you scale this to make it larger. Say 50 dates then the =Sum() needs to be moved each time.
在我的理论数据集中,我有一个显示销售日期时间的列表,以及完成交易的员工。
我知道如何进行分组以显示每位员工每天的销售额,但我想知道是否有一种方法可以计算有多少天的销售额超过 0。
例如,这里是原始数据集:
Employee | Order Time
A | 8/12 8:00
B | 8/12 9:00
A | 8/12 10:00
A | 8/12 14:00
B | 8/13 10:00
B | 8/13 11:00
A | 8/13 15:00
A | 8/14 12:00
这是我创建的枢轴 table:
Employee | 8/12 | 8/13 | 8/14
A | 3 | 1 | 1
B | 1 | 2 | 0
这是我想知道的:
Employee | Working Days
A | 3
B | 2
将您的订单时间列(假定为 B
)分成两部分,例如使用文本到列和 Space 作为分隔符(可能需要稍作调整)。然后如图所示进行透视(使用数据模型):
并对结果(在 PT 之外)求和,例如:
=SUM(F3:H3)
复制下来以适应。
列 F:G 可能会被隐藏。
我完全支持@Andrea 对上述内容的评论(更正):
I think this could have been made simpler. If you remove the "Time" in values of the pivot table and then move "Order" from columns to values and use distinct count as in the example. It should count Employee per date making the sum not needed. If you scale this to make it larger. Say 50 dates then the =Sum() needs to be moved each time.