Excel strange issue to recognise dates - excel

I have problem in formating the dates. I have dates that are recorded manually in dd.mm.yyy format. i have converted them to dd/mm/yyyy format using Left, right and Mid functions. The problem is that excel is able to identify only some cell values as dates and rest as text. I have also tried selecting the whole date range and convert to date. But when i apply filter the dates that are not recognised by excel are shown separately and the remaining under 2015 & 2016 years.
I need all the values to be converted and identify in excel. I am attaching screen shots of the same issue
Date different format
From the picture the row range from 23 to 28 in 2nd column is identified as date and row 29 to 34 is displayed as text. When i apply filter in second column, the date is shown as in below format
Filter issue

#Rejendra, I thing the problem you are having is that your computer is thying to evaluate the dates in american format e.g MM/dd/yyyy.
If you convert the date to yyyy-MM-dd using left right and mid functions and the excel formula =DATEVALUE it should work
If your computer is set to non US format you could simply use:
=DATEVALUE(SUBSTITUTE(A1,".","/"))
to convert it where A1 is the cell with the . delimited dates

Related

Change a four digit number to a year in Excel

I have a dataset that I'm working on. The dataset has a column with four-digit numbers. (1960, 1961,...2010)
I'm experimenting with the dataset in Power Query and I noticed that Power Query doesn't recognize the column as a year. Whenever I click on the column header and change the format to date, the numbers all change to 1905.
So, I tried to open it in Excel and change the formatting in it.
a screenshot from Excel
First, I tried to change the format to a yyyy date but the numbers turn to 1905.
I thought that maybe excel recognize the content of the columns as text so I tried to convert the text to a value in two ways (through the value() function and through multiplying the numbers by 1 then copying and pasting them as values) but whenever I change the format to a yyyy all the numbers change to 1905.
I tried the Text(,"YYYY") and it didn't work.
I tried to add a 01-01 to the column cells but it didn't work.
How can I let Excel or Power Query know that this column has years in it?
Any help will be appreciated.
Excel stores dates as serial numbers with 1=1-Jan-1900 So if you convert a number like 2000 to a date, Excel will add that number of days to 1-Jan-1900 and display the appropriate date. There is no way for Excel to know that you expect the Integer 2000 to be translated to a year.
In Excel, to translate that to a year, you can use a formula in an adjacent column =DATE(A1,1,1) => 1-Jan-2000
In PQ, you can also add a custom column with the formula =#date([year],1,1) where year is the name of your column with the year numbers, and the year column has Int64.Type or whole number

Excel Date Filter not grouping dates

I am pulling data from another spreadsheet and have a filter on the column header. The dates range from 2015 to 2018 off all months, weeks and days. Some of the dates are not grouping e.g. 15/03/2018 is loose underneath the 2018, 2017, 2016 and 2015 collapsible boxes.
All dates has come from the same source spreadsheet and the Marco formats them all as did/mm/yyyy when copying over.
Highlight the dates, and go to data -> Text to columns -> OK
Worked for me
I have found the formula DATE(YEAR(a1),MONTH(a1),DAY(a1)) will translate both strings that look like dates and actual dates into a date format.
Filtering and sorting behavior should then be consistent down the column.
I solved a similar problem by copying the column to notepad, and reinserting it. After this all dates were in the same format.
Make sure Excel recognizes the whole column as a set of dates.
Grouping requires all cells to be formatted as dates. Grouping will only work if there are no empty or text cells in a range and all cells have the same date format.
You may try the following steps to correct number format in the range:
remove any number formats (Home -> Clear -> Clear Formats...). After this step your date values shall look like numbers (e.g. 43284, 43285 etc.)
(optional) multiply the whole range by 1 (Copying "1" from a single cell and using "Paste Special"). This step effectively converts all cell formats to numeric
(optional) use filter to check if there are any empty / text cells left and fill them with numeric values (e.g. zeroes)
finally, apply the date format (Home -> Number -> Long Date)

Excel - Convert Date & Time to Date Format

I am working with a column of data which contains a date/time stamp of an event. The printed form is in US format, as follows:
12/25/2014 11:00 AM
The cells are formatted as "General". I'm looking to convert the column into a Date / Time field for ease of filtering and searching. Thus far the only way I've been able to convert the text is to use "Text to Columns" and import the columns delimited by a Space, but this hasn't gotten me exactly what I want as it imports the date perfect, but the time is still text and in another column, which isn't pretty.
Is there an easier way? Thanks in advance
Since these values are apparently text strings, you won't be able to change the values by formatting. Excel stores dates (and times) as days and fractions of a day since 1/1/1900. You have, I believe, four non-VBA options:
Change the data before you enter into your worksheet, to be in the same format as your Windows Regional Settings short date (perhaps DMY?)
Change your Windows Regional Settings short date format to match that of the data you are importing.
Split the data using Text to Columns as you have been, then combine the two fields with an addition. e.g.
Original data in A1
Split data in A1:B1
Combine -- C1: =A1+B1
Copy C1; PasteValues (C1), then delete A1:B1
Use a formula to separate the different segments. The following assumes your Windows Regional settings AM/PM designation is, indeed, AM/PM, otherwise the formula would have to also account for that. Also, if the format is mm/dd/yyyy hh:mm AM/PM then the formula could be simplified. The formula below assumes the format is m/d/yyyy h:mm AM/PM and that AM/PM works in your locale.
=DATE(
MID(A1,FIND("/",A1,4)+1,4),
LEFT(A1,FIND("/",A1)-1),
MID(A1,FIND("/",A1)+1,FIND("/",A1,4)-FIND("/",A1)-1)
)
+TRIM(MID(A1,FIND(":",A1)-2,9))
You should try custom formatting of date and time.
If working with Google spreadsheet see this link.
If working with excel see this link.

Why are date values "slipping through" a filter in Excel?

I'm cleaning data in Excel that has a date column with mm/dd/yyyy values mixed with dd/mm/yyyy values where the former are date formatted and the latter are general formatted. The way I'm doing this is to filter out everything that's date formatted (ie: shows up in the filter as 1964 -> March -> 27, etc... at various levels), leaving only those that are general formatted (shows up in the filter as as 27/03/1964). When I do this, I find that there are still date-formatted cells visible. I'm wondering why this is? Is it a consequence of how the filter works or how Excel reads date values?
I can't comment, as I don't have a rating of over 50.
I had a similar issue that you had, and realised that my dates were actually formatted as text. Setting the dates to a YYYY-MM-DD format, the cells wouldn't change unless I double clicked the cell, then clicked off of it.

Different date formats in Excel

I have a csv that contains a list of dates, once imported into Excel they are in 2 different formats. How can I get them all in the same format?
Example:
01/23/2012
01/26/2012
40910
41031
You probably have a BIG issue with your file!
Probably, Excel is recognizing dates as "dd/mm/yyyy" but your data is "mm/dd/yyyy" formatted.
So, your numbers are really dates (just format, as #t.thielemans suggested). But are incorrectly parsed - month and day are switched!
Solution (assuming your dates are on A:A column):
To convert text to date:
=DATE(RIGHT(A1;4);LEFT(A1;2);MID(A1;4;2))
To correct day/month:
=DATE(YEAR(A1);DAY(A1);MONTH(A1))
Detect whether cell has date (dates are numbers, in Excel) or text:
=ISNUMBER(A1)
Finally, all combined within one formula:
=IF(ISNUMBER(A1);DATE(YEAR(A1);DAY(A1);MONTH(A1));DATE(RIGHT(A1;4);LEFT(A1;2);MID(A1;4;2)))
Just drag last formula from first row to end of your data and then format it as you wish (see #t.thielemans solution).
Select your data column and make sure they're highlighted. Go to Home>Number and select Custom and enter mm/dd/yyyy. You can also change the layout to one you want (mm-dd-yyyy/mmddyyyy/dd-mm-yyyy/...)

Resources