简体   繁体   English

Excel逻辑,如果大于0则计数(带日期)

[英]Excel logic, count if larger than 0 (with dates)

I have three columns, each for three periods (1-11, 11-21 and 21-31 i the month). 我有三列,每列三个月(当月的1-11、11-21和21-31)。 Each of these columns have a top cell with a number representing how many 0's I have in the rows below (a checklist where 1 means DONE and 0 means not done). 这些列中的每一列都有一个顶部单元格,其中一个数字表示我在下面的行中有0个数字(清单1,其中DONE表示完成,0表示未完成)。 I also have a column with dates from 1-31. 我也有一栏,其日期为1-31。 Then I have three cells that tell me "# left period 1, 2 and 3". 然后我有三个单元告诉我“#left period 1,2和3”。 My issue is that I don't know how to get anything but #DIV/0 if the period has ended, and there are still tasks left to be done. 我的问题是,如果期限结束,除了#DIV / 0外,我不知道如何获得任何东西,而且还有许多工作要做。 Ie. IE浏览器。 how to say "If TODAY". 怎么说“如果今天”。

I've added an example file: https://drive.google.com/folderview?id=0B5XqxNeZQfssU19IcFhTQ1R3eG8&usp=sharing 我添加了一个示例文件: https//drive.google.com/folderview?id = 0B5XqxNeZQfssU19IcFhTQ1R3eG8&usp =sharing

OLD POST: 旧帖子:

It works fine counting as long as the period has not ended, then I get a '#DIV/0!'-error. 只要期间还没有结束,它就可以正常计数,然后出现“#DIV / 0!”错误。 Can someone help me? 有人能帮我吗?

It looks like: 看起来像:

Cell with "Tasks left / day Period 1": “任务剩余/日期1”的单元格:

 =(K10+(N185/3))/(COUNTIF(Period1[Period =(K10 +(N185 / 3))/(COUNTIF(PERIOD1 [时段\n1];">"&TODAY())) 1]; “>” &TODAY())) 

K10 is the cell with the total of 0's for this period. K10是这一时期总共为0的细胞。 N185 is tasks not governed by periods, thus split by 3. Period1[Period 1] is the table and column with the dates that should be counted in Period 1. N185是不受时段约束的任务,因此除以3。Period1 [Period 1]是具有应在时段1中计数的日期的表和列。

Sample data: 样本数据:

 
A1 [formula for tasks left / day period 1 here]

\n\nK10 K11 K12 K10 K11 K12\n[5] [0] [0] [5] [0] [0]\n\n[1] [1] [1] [1] [1] [1]\n[0] [1] [1] [0] [1] [1]\n[0] [1] [1] [0] [1] [1]\n[1] [1] [1] [1] [1] [1]\n[0] [1] [1] [0] [1] [1]\n[0] [1] [1] [0] [1] [1]\n[0] [1] [1] [0] [1] [1]\n\nN185 N185\n[3] [3]\n\n[1] [1]\n[1] [1]\n[1] [1]\n[0] [0]\n[0] [0]\n[0] [0]\n\nPeriod1[Period 1] (table) Period1 [Period 1](表)\n2016-03-04 2016年3月4日\n2016-03-05 2016年3月5日\n2016-03-06 2016年3月6日\n2016-03-07 2016年3月7日\n2016-03-08 2016年3月8日\n2016-03-09 2016年3月9日\n2016-03-10 </code></pre> 2016-03-10 </ code> </ pre>\n

So, if today is 15th of march, the result should be 6 in A1. 所以,如果今天是3月15日,结果应该是A1中的6。 Now I get '#DIV/0!' 现在我得到“#DIV / 0!” as there is no date that is '>' today. 因为今天没有'>'的日期。 With this result I'm ending up pretty blind regarding any backlog. 有了这个结果,我对任何积压都很瞎了。

Your #DIV/0! 您的#DIV/0! error is occurring when the number of available data to complete the tasks runs out. 当完成任务的可用数据数用完时,会发生错误。 However, this also changes the outcome from 'to-be-done' to 'not-completed-in-time' and the divisor should reflect that. 然而,这也将结果从“待完成”改为“未完成时”,并且除数应该反映出来。

=(K10+(N185/3))/MAX(COUNTIF(Period1[Period 1],">"&TODAY()), 1)

The above will never allow a division by less than 1 and a division by 1 does not affect the number so the numerator and quotient are the same. 上面的方法永远不允许除以1,并且除以1不会影响数字,因此分子和商是相同的。 Similarly, the text label in A2 could be changed to a formula like, 同样,A2中的文本标签可以更改为以下公式:

=IF(MAX(Period1[Period 1])<TODAY(), "Left P1", "Left/Day P1")

These changes should be carried across to the formulas in B1:C2. 这些更改应沿用到B1:C2中的公式。

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

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