Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excel: Check cell for date

Short story short:

I want to check the cell C21 if it contains a date. I can't use VB cause it's deactivated by GPO.

Used this from this page

D21 contains this:

=WENN(ISTZAHL(DATWERT(C21));"date";"no date")
in english
=IF(ISNUMBER(DATEVALUE(C21))...

C21 this:

=HEUTE() # in english: =TODAY() Maybe other dates later, but allways in the correct format

but it allways returns "no date"

like image 266
globus243 Avatar asked Jun 11 '15 10:06

globus243


People also ask

How do you say if a cell contains a date?

Check for a number or date To check if a cell contains a number or date, select the output cell, and use the following formula: =IF(ISNUMBER(cell), value_to_return, ""). For our example, the cell we want to check is D2, and the return value will be Yes.

Can you use the IF function in Excel with dates?

If you have a list of dates and then want to compare to these dates with a specified date to check if those dates is greater than or less than that specified date. You can use the IF function in combination with logical operators and DATEVALUE function in Microsoft excel.


1 Answers

Use this formula, the expression will return TRUE if cell A1 contains an invalid date.

=ISERROR(DATE(DAY(A1),MONTH(A1),YEAR(A1)))

This formula works by evaluating each component part of the date: DAY, MONTH and YEAR and then aggregating them using the DATE function.

ISERROR will the catch any errors by returning TRUE (invalid) otherwise FALSE (valid).

Obviously the date value in cell (A1) must contain values >= 01/01/1900.

Useful for "Conditional Formatting".

like image 162
GBGOLC Avatar answered Oct 14 '22 09:10

GBGOLC