Conditional Format or VBA Script

%3CLINGO-SUB%20id%3D%22lingo-sub-3482397%22%20slang%3D%22en-US%22%3EConditional%20Format%20or%20VBA%20Script%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3482397%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20a%20report%20that%20I%20am%20needing%20to%20highlight%20the%20column%20that%20has%20dates%20in%20it%2C%20if%20the%20date%20is%20not%20formatted%20mm%2Fdd%2Fyyyy%2C%20blank%2C%20missing%20dashes%20or%20slashes.%20I%20have%20a%20conditional%20statement%20for%20blank.%20But%20I%20am%20having%20problems%20getting%20a%20conditional%20formula%20for%20the%20date%20not%20being%20formatted%20correctly%20or%20missing%20dashes%20or%20slashes.%20Would%20a%20vba%20script%20be%20better%20to%20use%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3482397%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3482727%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20Format%20or%20VBA%20Script%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3482727%22%20slang%3D%22en-US%22%3Ewhy%20not%20let%20excel%20determine%20if%20it%20is%20a%20proper%20formatted%20date%20string%3A%3CBR%20%2F%3E%3DISNUMBER(%20DATEVALUE(%20A1%20)%20)%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3484067%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20Format%20or%20VBA%20Script%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3484067%22%20slang%3D%22en-US%22%3EI%20get%20a%20spreadsheet%20in%20that%20can%20list%201000's%20of%20accounts%20including%20DOB.%20If%20the%20dates%20are%20not%20formatted%20to%20mm%2Fdd%2Fyyyy.%20I%20have%20to%20highlight%20the%20field%20and%20end%20back%20to%20the%20client%20to%20fix.%20sometimes%20they%20blank%2C%20which%20I%20have%20a%20conditional%20formatting%20rule%20for%20that.%20They%20may%20just%20be%20a%20set%20of%20numbers%3A%20121522.%20This%20is%20not%20a%20date%20formatted%20correctly.%20I%20was%20looking%20for%20something%20that%20I%20can%20set%20as%20a%20conditional%20format%20or%20even%20a%20vba%20script%20for%20a%20macro%20to%20run%20and%20check.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3484149%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20Format%20or%20VBA%20Script%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3484149%22%20slang%3D%22en-US%22%3Ethat%20is%20what%20I%20gave%20you.%20IF%20excel%20can%20recognize%20that%20text%20string%20as%20a%20valid%20date%20format%20it%20will%20then%20convert%20it%20to%20a%20date%20object%2Fvalue%2Fnumber%20but%20if%20not%20it%20will%20error%20and%20the%20ISNUMBER()%20will%20check%20if%20excel%20succeeded%20or%20not%20(you%20could%20also%20use%20%3DIFERROR(%20DATEVALUE(%20A1%20)%20%2C%200%20)%3CBR%20%2F%3EPut%20the%20replace%20the%20A1%20with%20the%20very%20top%20left%20cell%20of%20the%20'Applied%20to'%20range%20of%20the%20conditional%20formatting.%20This%20assumed%20the%20data%20is%20being%20imported%20as%20text.%20If%20excel%20already%20recognizes%20the%20cells%20as%20date%20values%20we%20will%20have%20to%20add%20another%20part%20to%20the%20condition.%3C%2FLINGO-BODY%3E
Occasional Contributor

I have a report that I am needing to highlight the column that has dates in it, if the date is not formatted mm/dd/yyyy, blank, missing dashes or slashes. I have a conditional statement for blank. But I am having problems getting a conditional formula for the date not being formatted correctly or missing dashes or slashes. Would a vba script be better to use?

3 Replies
why not let excel determine if it is a proper formatted date string:
=ISNUMBER( DATEVALUE( A1 ) )
I get a spreadsheet in that can list 1000's of accounts including DOB. If the dates are not formatted to mm/dd/yyyy. I have to highlight the field and end back to the client to fix. sometimes they blank, which I have a conditional formatting rule for that. They may just be a set of numbers: 121522. This is not a date formatted correctly. I was looking for something that I can set as a conditional format or even a vba script for a macro to run and check.
that is what I gave you. IF excel can recognize that text string as a valid date format it will then convert it to a date object/value/number but if not it will error and the ISNUMBER() will check if excel succeeded or not (you could also use =IFERROR( DATEVALUE( A1 ) , 0 )
Put the replace the A1 with the very top left cell of the 'Applied to' range of the conditional formatting. This assumed the data is being imported as text. If excel already recognizes the cells as date values we will have to add another part to the condition.