ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   compare dates with different formats (https://www.excelbanter.com/excel-programming/447777-compare-dates-different-formats.html)

gwc

compare dates with different formats
 
What Excel formula can I use to determine if the date in each row in Col B is later (i.e., later) than the date in Col A?

A B
12111995 01/10/1996
11012007 01/23/2008
02282009 05/11/2009
06061989 09/13/1989

(I can't use macros or VBA)







Claus Busch

compare dates with different formats
 
Hi,

Am Mon, 3 Dec 2012 10:46:48 -0800 (PST) schrieb GWC:

A B
12111995 01/10/1996
11012007 01/23/2008
02282009 05/11/2009
06061989 09/13/1989


try:
=B1DATE(RIGHT(A1,4),LEFT(A1,2),MID(A1,3,2))


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2

joeu2004[_2_]

compare dates with different formats
 
"GWC" wrote:
What Excel formula can I use to determine if the date
in each row in Col B is later (i.e., later) than the
date in Col A?
A B
12111995 01/10/1996
11012007 01/23/2008
02282009 05/11/2009
06061989 09/13/1989


Normally, the format of a date does not matter. If column A contains Excel
dates simply formatted as Custom mmddyyyy, you can simply do
IF(B1A1,"later","not later").

However, if column A contains those values as integers (formatted as Custom
00000000?) or as strings, you will need to convert them.

IMHO, it would be best to convert all of the dates in column A. The Text To
Column operation might do the job. But IIRC, it has problems with certain
ambiguous representations, despite the leading zeros. Test or review the
results carefully.

If you do not want to convert all of the dates in place, you can do the
following:

IF(B1--TEXT(A1,"00\/00\/0000"),"later","not later")



All times are GMT +1. The time now is 10:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com