Paresh Mhetre
Paresh Mhetre

Reputation: 11

compare extracted date with today() in excel

Column 1 : I have this date-time format in one column = 2018-10-08T04:30:23Z

Column 3 : I extracted date with formula = =LEFT(A11,10) and changed column format to date.

Column 32 : today(). Just to make sure both date columns match

Now when I want to compare both dates

Column 4 : =IF(C11=D11,TRUE(),FALSE())

It does not work. What did I do wrong?

enter image description here

Upvotes: 1

Views: 2712

Answers (2)

pnuts
pnuts

Reputation: 59495

Should be worth trying:

=1*LEFT(A1,10)=TODAY()

May depend upon your configuration. Without format conversion (the 1*) you are trying to compare text (all string functions return Text) with a Number.

Upvotes: 0

Tim Biegeleisen
Tim Biegeleisen

Reputation: 522817

One option using formulas only would be to use Excel's DATE function, which takes three parameters:

=DATE(YEAR, MONTH, DAY)

Use the following formula to extract a date from your timestamp:

=DATE(LEFT(A1,4), MID(A1,6,2), MID(A1,9,2))

This assumes that the timestamp is in cell A1, with the format in your question. Now, comparing this date value against TODAY() should work, if the original timestamp were also from today.

Upvotes: 1

Related Questions