Excel:检查单元格的日期 [英] Excel: Check cell for date
问题描述
短篇小说短片:
我想检查单元格C21是否包含日期.我无法使用VB,因为它已被GPO停用.
I want to check the cell C21 if it contains a date. I can't use VB cause it's deactivated by GPO.
=WENN(ISTZAHL(DATWERT(C21));"date";"no date")
in english
=IF(ISNUMBER(DATEVALUE(C21))...
C21:
=HEUTE() # in english: =TODAY() Maybe other dates later, but allways in the correct format
但始终返回无日期"
推荐答案
使用此:=IF(LEFT(CELL("format",C21))="D",..,..)
.详细了解CELL
公式
Use this: =IF(LEFT(CELL("format",C21))="D",..,..)
. Learn more about CELL
formula here.
在您的示例中,=TODAY()
已经是真实日期,而不是存储为文本的日期,因此在此处使用DATEVALUE
并没有太大意义.
In your example =TODAY()
already a real date and not a date stored as text, so doesn't make too much sense to use DATEVALUE
there.
以下是一些示例日期以及CELL
如何识别它们:
Here are some example dates and how CELL
recognize them:
format value output
dd/mmmm/yyyy 12/June/2015 D1
dd/mm/yyyy 12/06/2015 D1
yyyy 2015 G
general 2015 G
dd/mm 12/06 D2
mmmm June G
dd mmmm yyyy 12 June 2015 G
注意:CELL
并非易失,因此,如果源单元格的格式发生更改,它将不会自动刷新,您需要重新计算表格/书本,打开公式并按Enter键(也可以自动重新计算)由任何其他易失性公式发起的操作都会使其刷新).
Note: CELL
is not volatile, so if the format of source cell is changed it won't be refreshed automatically, you need to either recalculate your sheet / book, either open the formula and press enter (also automatice recalculation initiated by any other volatile formula will cause it to refresh).
这篇关于Excel:检查单元格的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!