没有重复,统计每天进入的人数

我正在使用如下的工作表:

date/时间徽章名称
 2013年10月31日    
 8:01:02 AM 131078 YEO,Nita
 8:03:17 AM 415416 PEH,魏
二○一三年十月三十○日    
上午8:11:02 131098李,爱丽丝
上午8:53:17 215416 EG,shi
 ... 
  1. 我想统计一天内没有重复input的人数。 只是date,而不是确切的时间。 每个人都有一个唯一的徽章号码。

  2. 之后,我有另一个工作表,所有empoyees`徽章号码。 我想比较这个表格中input的人物以排除访问者,也就是两个表格里面的人都保留着。 然后算一下多less。

综上所述,在一个月内,每天进入的人数不是访客数。 并根据date绘制数字。

如何使用Excel,数据透视表或VBA来完成这项工作?

在Excel中,在最左边添加一列,并且假设“date/时间”在B1中,在A2中input=IF(ISBLANK(C2),B2,A1)并拷贝以适合。 将ColumnA和Paste Special,复制到顶部。 过滤(空白)ColumnC并删除选定的行。 在A1中添加Date 。 现在您的数据布局应该像@Brett推荐的那样或多或less。


使用查找function来添加到每一行是否Visitor的指示。

根据图像左侧的源数据显示的数据透视表将显示每天唯一的徽章访问次数:

SO19764305的例子

筛选以在“报告筛选”字段中仅selectn ,并且只有员工才具有相应的职位。

对于每月的数字使用本集团(在快速菜单),按,月份设施。

对于图表,从行标签中删除徽章并插入合适的图表。

像这样的东西

 from collections import defaultdict # collect all visitors in a dictionary where the key is the date, and # the value is a set of badge numbers visitorsPerDay = defaultdict(set) # store the last read date value currentDate = None with open('filename') as f: for line in f: # if the line is 10 characters long, it's a date line if len(line.strip()) == 10: # store the date value currentDate = line.strip() elif currentDate: # extract the badge number; if the file is tab # separated, even better: split by \t time, badge, _ = (part.strip() for part in line.split(' ', 2)) # add the badge number to the set within the dictionary visitorsPerDay[currentDate].add(badge) # now for every date, count the number of (unique) visitors for date, visitors in visitorsPerDay.items(): print(date, len(visitors))