Date validation in MM/DD/YYYY format in excel column? - excel

I am trying to validate an excel column having date field of DD/MM/YYYY format.It's an existing column , I want to color/differentiate cells having wrong values.
It should always be in DD/MM/YYYY format.
It should validate data also. like 29/02/2017 should mark as wrong entry. similarly 31/04/2018 is wrong entry.
I don't know if there is any easy way of validation of both structure and data in excel for already defined excel fields. Any help?

If you have dates in range A2:A10 then select the first cell, A2. From the Home tab, use Conditional Formatting, Manage Rules, New Rule. Under use formula enter =ISERR(DAY(A2)). Use Format to set the cell formatting, then select OK. Then in the Conditional Formatting Rules Manager, modify the range under Applies to $A2:$A10. This will highlight all the none dates.

I see two ways of accomplishing this task.
The first method would be to do conditional formatting as you have requested with this formula.
=IF(AND(NOT(ISERR(DAY(A2))), CELL("Format", A2)="D1"),TRUE, FALSE)
The second method could be used, but doesn't require the use of conditional formatting instead it using Data Validations. Data Validations won't change the color of a cell, but it will prevent you from inserting a invalid date.
Format the Cell 'Number' to a category type of 'Custom' and then the type should read - 'dd/mm/yyyy'
Now, add 'Data Validation' to the cells in question. The 'Data Validation' should be the following
Allow: 'Date'
Data: 'greater than'
Start Date: '01/01/1900'
Once you have done this, all of the dates will still need to be TYPED as 'mm/dd/yyyy' but as soon as your press 'enter' then the format will change it over to 'dd/mm/yyyy'

Related

Conditional formatting is not working for less than TODAY(), only for greater than

Conditional formatting does not apply to dates less than TODAY(), only greater than TODAY().
I have an IF statement with two VLOOKUPS inside. One of them outputs "Not Registered" if the cell looked is empty. The other, just copy the data that is on the other spreadsheet.
=IF(VLOOKUP($A5,Table,#MATCH(D$3,Headings,0))=0,"Not
Registered",VLOOKUP($A5,Table,#MATCH(D$3,Headings,0)))
Conditional formatting is set to:
cell values >= TODAY() are green
cell values < TODAY() are red
cell values = "Not Registered" are yellow
I suspect the conditional formatting is not reading properly the date. Every date cell is formatted as long date.
The problem comes up because A3 is empty.
Change the rules to use =Today() or populate A3 with the desired date.
Edit 1: If this is not working for you, check the data type of cells that should be red. If these are not real dates (but text), then they will never meet the condition. Make sure that all cells that look like dates actually contain dates (and not text).
If the lookup table stores the dates as text, then you can make the changes there, because the Vlookup will return the same data type.
Edit 2: Selecting a cell and changing its format will NOT convert text to a date. You can test if a date is really a date by changing its format to General. If this results in the cell showing a number, then it's a real date. But if the cell appearance does not change, the value is text and you need a different approach.
One option would be to use a helper column with a formula like =DateValue(A1). Copy the helper cells and paste them as values over the original cells, then format as date.
Or, put a zero into any cell, copy the cell, then select all cells that may or may not be dates and use Paste Special > tick "Add" > OK. That will convert dates stored as text back to their internal storage number. Then format the cells as dates.
Or, do the conversion after the Vlookup by wrapping a DateValue around the VLookup formula.
=DATEVALUE(VLOOKUP("a",A1:B1,2,0))
The "date" in B1 is really text. The Vlookup returns it as text, but the DateValue() then converts it to a date. If this one throws an error, the date text does not agree with your regional settings of what a date is expected to look like.
Reason:
Whenever the cell go past by the Less than today rule, computer will read that as zero so it will return true because zero is less than today.
Solution:
On the Conditional Formatting Rules Manager,try to enable the Stop if true for the not registered rule.

Excel convert dates from different formats

I have a data set with column A containing different date formats, the column format is date:
I would like to have all entries in the format dd-mm-yyyy, and one formula for the whole column.
With format cells, I could not get them into the same format.
I tried TEXT(A3, "dd-mm-yyyy"), but this does not do anything.
DATEVALUE(A3) gives me an error.
Is there a simple solution to this?
Given that Excel cannot parse the date before 01-01-1900 you'd need a proper date and then select your range, and go Data>Text to Columns.
Here, select Delimited and click Next. Deselect all options (usually only Tab is selected) and click Next. Select Date option and choose the format which seems to be DMY in your case.
Then you can use the formula such as:
=TEXT(A3,"dd-mm-yyyy")

Excel - Only format column if TODAY

I have been trying to do this myself for a good few weeks now but it seems I do require some expertise here!
As I state in the Title, I'm trying to format duplicate values ONLY if date (located C1:AG1) =today. The values per day are in cells C2-AG28, the table of reference is AI2:28.
I don't have enough reputation to submit an attachment so I hope this is enough information for someone to shed a light on this.
Conditional formatting.
Click cell C1 and click conditional formatting and then new rule.
For the rule, use a formula to determine which cells to format and use this formula:
= C$1=TODAY()
Change the format to whatever you want and then apply this rule to the desired range (C1:AG28).
Clear any existing CF from the relevant range, select it and HOME > Styles - Conditional Formatting, New Rule..., Use a formula to determine which cells to format and Format values where this formula is true::
=AND(C$1=TODAY(),COUNTIF(C:C,C1)>1)
Format..., select choice of formatting OK, OK.
Select the range C2:AG28 and create a new Conditional Formatting rule using a formula. The formula should be entered as follows:
=AND(C$1=TODAY(),COUNTIF(C$2:C$28,C2)>1)
The first part, identifying the column containing today's date in the first row is self-explanatory. The countif section of this formula works by identifying only those values which appear more than once in the column (e.g. having a count > 1). The way we limit this to a particular column, rather than the entire table, is by omitting the $ in front of the column in the address.

Conditional formatting on dates older than a month in Excel

I have a column in my table that has dates, and I want to highlight any that are over a month old. I've been given the formula =B5<TODAY()-30, but when I try apply that to multiple fields it only takes it from B5, so highlights all of them.
I've seen a few if statements that play with dates, but I can't get them to work either (I can't find them any more).
How can I get this to work over the whole column, not just the one?
Your formula is correct, but make sure you enter it like this:
Select the range that starts with B5 and goes down as far as you want before opening the Conditional Formatting dialog.
Select: New Rule.
Select: Use a formula to determine which cells to format
Enter your formula into the box labeled, "Format values where this formula is true"
Click on the Format button and select the formats you wish.
Confirm.

Change cell color is cell value is any date

I have a map with data in Excel 2007 and need to have a kind of conditional format to change cell color if the data in the cell is a date. Must work on any date so can't use the "in between" date conditional formula.
Has to give other data another color.
Not sure about "have a map" and you don't mention any specific date format (string or numeric?) but a Conditional Formatting formula rule of:
=CELL("format",A1)="D1"
might suit, with an Applies to range as appropriate.

Resources