简体   繁体   English

日期范围内的天数-Excel

[英]number of days in date range - excel

I am new to excel and been struggling to find a way to get ( count ) the number of dates (ie 14 ) from a cells range (ie B1:B12 ) considering that every cell has different date that not in sequence with the one in next cell. 我是新手,擅长寻找一种从单元格range (即B1:B12 )中获取( count )日期数(即14 )的方法,考虑到每个单元格的日期都不相同,下一个单元格。

Thanks. 谢谢。

EDIT:

Sorry I forgot to mention that I have time included with the date in each cell like the following: 抱歉,我忘了提及我在每个单元格中的日期中都包含时间,如下所示:

Row: 1/2/2013 12:00:00 pm,1/2/2013 10:00:00 pm,5/9/2009 5:00:00 pm,1/2/2013,4/10/2013 1:00:00 am I need a way to get number 3 for that row. 行: 1/2/2013 12:00:00 pm,1/2/2013 10:00:00 pm,5/9/2009 5:00:00 pm,1/2/2013,4/10/2013 1:00:00 am我需要一种方法来获取该行的3号。

Try this 尝试这个

=SUM(IF(FREQUENCY(B2:B12,B2:B12)>0,1))

Reference: 参考:

http://office.microsoft.com/en-us/excel-help/count-occurrences-of-values-or-unique-values-in-a-data-range-HP003056118.aspx http://office.microsoft.com/zh-cn/excel-help/count-occurrences-of-values-or-unique-values-in-a-data-range-HP003056118.aspx

Edited: 编辑:

Yes, according to comment from @barry, you can use int to drop the time, but you need to enter it as an array formula 是的,根据@barry的评论,您可以使用int来减少时间,但是您需要将其作为数组公式输入

{=SUM(IF(FREQUENCY(INT(B2:B12),IF(B2:B12<>"",INT(B2:B12)))>0,1))}

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

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