Change date format in excel - excel

I am getting data in a CSV file with data column having format e.g. 1987-09-17T00:00:00.000-06:00.
When I apply date formatting on it to say DD/MM/YYYY, it doesn't change to 17/09/1987.
Is there a way to achieve this?
Thanks!

Excel will assume it is text because it is not in a format it recognises as being a date. You could use LEFT() and MID() functions to split out the parts you want as arguments in the DATE() function. Eg
=DATE(left(A1,4),(MID(A1,6,2),MID(A1,9,2))

Related

Using a CDate in a Countifs function

I was wondering if there was a way to use the CDate function in a countif statement? I'm trying to find dates less than 2 weeks old, am and currently using this statement:
=COUNTIF(CDATE(Table1[Date Closed]),">=" &TODAY() - 14)
I need to turn the Date Closed of the table into actual dates without changing the table (right now they're in the format 13-Mar-2018 but as text format).
Is there a way to do this within the Countif function or am I going to have to do a a VBA code to first change the dates?
Thank you!
=SUMPRODUCT(--(DATEVALUE(Table1[TextDates])>=(TODAY()-14)))
Although I do wonder why you can't have dates as real Excel dates, rather than text strings
Set up your table and insert a column (you could hide the original or place the new column at the end or next to the original) and convert the text date to a date via the DATEVALUE() function.
See reference:
https://support.office.com/en-us/article/datevalue-function-df8b07d4-7761-4a93-bc33-b7471bbff252
You may want to apply format to the new cell/column to look like a date.
Set up your table for "Using structured references with Excel tables."
See reference:
https://support.office.com/en-us/article/using-structured-references-with-excel-tables-f5ed2452-2337-4f71-bed3-c8ae6d2b276e
Count dates based on your condition.
See reference:
https://support.office.com/en-us/article/count-numbers-or-dates-based-on-a-condition-976d0074-245d-49e6-bf5f-1207983f82ed

Excel convert decimals to Time

I have a date/time field extracted from SQL.
Value is 2016-08-25-00.56.09.861000
I want to just get the time out of this to check if the time is before or after 9am.
I have extracted the time:
=RIGHT(A1, LEN(A1)-11)
Is there a way to then convert this to time format 00:59:09 that I can then use to compare against 09:00:00?
Thanks
Try this
=TIME(MID(A1,FIND(".",A1,1)-2,2),MID(A1,FIND(".",A1,1)+1,2),MID(A1,FIND(".",A1,1)+4,2))
after that convert result to hh:mm:ss by using format cell
Since your data in A1 is a defined format, you can use:
=TIMEVALUE(SUBSTITUTE(MID(A1,12,8),".",":"))
And format the cell containing this formula as a time.

mddyyy convert to mmddyyyy in excel

i have a file which contains dates like 5062014(not properly formatted) along with dates like 05062014(properly formatted) in excel.How to change those dates which are not properly formatted.Can we apply any formula in excel for that?
In my opinion you can convert the dates with this: https://support.office.com/en-us/article/Format-a-date-the-way-you-want-8e10019e-d5d8-47a1-ba95-db95123d273e

Excel DateValue = Formatting

Looking to convert the following 2015-10-07T23:59:59 into something that Excel actually recognizes as a date so I can then graph/chart with this data... I tried using datevalue and custom formatting but can't get the syntax quite right.
To get datetime from your string, you only need to replace T with space, convert to numeric and apply appropriate cell format.:
=1*SUBSTITUTE(A1,"T"," ")
I dont know if Excel can understand that type of format date, you should try to write your own custom function to get it in the format that you want.
How about yyyy-mm-ddThh:mm:ss for the custom format?
If the timestamp isn't needed, use =DATEVALUE(LEFT(A1,10)). If it is needed, then use =DATEVALUE(LEFT(A1,10))+TIMEVALUE(RIGHT(A1,8)). (Where cell A1 contains the datetime string you are trying to parse).
This will return the Julian date value (E.g. 42284 for the day, 42284.96 for day & time) which you can then apply Excel's built in date formatting to, it will also work for charts and pivot table grouping.

Error in Date Cell in CSV

I have a date column with YYYY/MM/DD HH:MM:SS AM/PM format in Excel file(xlsx).
But when I am trying to save it in CSV format then the values in date column converts to MM/DD/YYYY HH:MM .
But I want to keep the values in the same format.
Please help me to solve this and Thanks in advance.
Use Custom format as yyyy/mm/dd hh:mm:ss AM/PM in Type text box and save as csv should work
This is a well known problem with CSVs. You can't provide any sort of formatting information about the column to excel, and so it takes liberties with dates. One way around it is to trick excel into processing the column as a string value, instead of a date value, by wrapping it in ="", so an example csv might look like this:
Sample.csv
Name,Date,Note
Foo,="2014/12/03 12:14:15 AM",Bla
Bar,="2012/11/13 3:14:15 PM",Bla Bla
Excel will preserve the date format because it will process it as a string value, so it will not modify it in any way.

Resources