[英]Excel formula to return earliest date in a range & ignores blank cells
I was able to use the MIN function to return earliest date in a range, but I also found that it returns a default excel date (12/30/1899) when the range of cells are empty. 我能够使用MIN函数返回某个范围内的最早日期,但是我还发现,当单元格范围为空时,它将返回默认的excel日期(12/30/1899)。 Is there another way to avoid the default date for blank cells and return blank? 还有另一种方法可以避免空白单元格的默认日期并返回空白?
For example: Range 1 7/1/2014 7/2/2014 6/30/2014 例如:范围1 7/1/2014 7/2/2014 6/30/2014
Result = 6/30/2014 结果= 6/30/2014
Range 2 (cells are blank because they're still waiting for input) ... ... ... 范围2(单元格为空,因为它们仍在等待输入)…………
Result = 12/30/1899 结果= 12/30/1899
这应该工作
=If(Min(A:A) > 0, Min(A:A), "")
Another formula approach would be to use SMALL
rather than MIN
- SMALL will return an error if there are no dates in the range (rather than zero) so you can clean the error up with IFERROR
, eg 另一种公式方法是使用SMALL
而不是MIN
如果范围内没有日期(而不是零),SMALL将返回错误,因此您可以使用IFERROR
清除错误,例如
=IFERROR(SMALL(A1:A100,1),"")
....or you can retain your current formula with a simple MIN and just custom format the result field so that zeroes don't display, eg custom format as ....或者您可以使用简单的MIN保留当前公式,并仅对结果字段进行自定义格式,以便不显示零,例如,自定义格式为
mm/dd/yyyy;;
Note the two semi-colons - those must be included 请注意两个分号-必须包含这些分号
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.