Excel convert text (April 1, 2017) to date - excel

I have some dates in my Excel spreadsheet that are in this format to change it to convert to a date format of dd/mm/yyyy, or any form that allows me to sort by date.
How would I be able to do this using a formula? April 1, 2017 = 01/04/2017
Thanks!
P.s. I've looked through the question: How to convert the text to date format in excel
It looked similar, but the formula doesn't work even when I take out the timevalue portion.

If the "date" is being read as text, and your "date" format will always be mmmm d, yyyy, you can try the following (assuming cell A1 has the "date"):
=DATE(RIGHT(A1,4),MONTH(LEFT(A1,3)&1),MID(A1,FIND(" ",A1)+1,FIND(",",a1)-FIND(" ",A1)-1))
After which, you can just set a custom dd/mm/yyyy format to that date. OR you can enclose the formula above in a TEXT() function:
=TEXT(DATE(RIGHT(A1,4),MONTH(LEFT(A1,3)&1),MID(A1,FIND(" ",A1)+1,FIND(",",a1)-FIND(" ",A1)-1)),"dd/mm/yyyy")
What I would recommend, however, is using the first formula and setting a custom format.

Related

Date format conversion in Excel

I have a list of dates, which seem to be in dd/mm/yyyy hh:mm format ( Ex - 12/13/2022 12:16 AM ) , which is incorrect. I need to change to mm/dd/yyyy hh:mm format.
I tried the formula =IF(H2="","",IF(DAY(H2)>12,DAY(H2)&"/"&MONTH(H2)&"/"&YEAR(H2),VALUE(DATE(YEAR(H2),DAY(H2),MONTH(H2)))))
but the result is #Value
You seem to be missing the point: a datetime format in Excel is a normal number, where 1 means one day, starting at the first of January, 1900.
Let me show how it looks on my PC:
As you can see, there are two ways to describe the thirteenth of December, 2022:
format dd/mm/yyyy : 13/12/2022 (European style)
format mm/dd/yyyy : 12/13/2022 (American style)
But as you can see below, the actual values are the same (44908 is the amount of days starting at January first 1900).
Doing calculations on this, like checking =DAYS()>12, has no meaning, because the days will be calculated from that 44908 number, not from the way it's displayed.
So, don't start formulas on that, just alter the way it's displayed (using cell formatting, as shown in my screenshot).

Date incorrectly converts into required format (dd/mm/yy) in excel

Hi I know lots of similar questions can be found here, but I am still facing this problem:
I have a table with one column called Dates with some values shown below:
12/2/2021
11/2/2021
10/2/2021
9/2/2021
8/2/2021
7/2/2021
6/2/2021
5/2/2021
4/2/2021
3/2/2021
2/2/2021
1/2/2021
31/01/21
30/01/21
When I try to convert it using Format cells either by selecting category as Date or adding custom category as dd/mm/yy, excel treat the dd/mm/YYYY values as mm/dd/yy.
So for example, instead of treating 1st row as 12 February, excel thinks of it as 2 December.
I also tried convert text to columns by going to DATA and setting it as DMY but it doesn't solve the problem.
Any help is really appreciated.
Try this formula:
= DATE( YEAR(A1), DAY(A1), MONTH(A1) )
If the values have any space character, try this one:
= DATE( YEAR(TRIM(A1)), DAY(TRIM(A1)), MONTH(TRIM(A1)) )
Assumptions:
All the dates were originally DMY
Your windows regional settings short date format is MDY
You will need to convert to a proper date
If the value is text, then it will be in DMY format and you can extract the sections and convert to a date
If the value is numeric, then it has been converted improperly and you need to reverse the month and day part
Given those assumptions, the following formula should work.
I am using the LET and FILTERXML functions which are available in Excel Office 365 Windows versions.
If you don't have that version of Excel, you can still do this with formulas but it will be more complex. Or you can use VBA.
=IFERROR(DATE(YEAR(A1),DAY(A1),MONTH(A1)),
LET(x,FILTERXML("<t><s>" & SUBSTITUTE(A1,"/","</s><s>")& "</s></t>","//s"),
DATE(INDEX(x,3)+IF(INDEX(x,3)<30,2000),INDEX(x,2),INDEX(x,1))))

Change date in excel

I am trying to change the date format of my cells in excel to another date format. Currently it is in this format: apr, 10, 2017 01:58:24 PM. I would like to have it in a normal format like dd-mm-yyyy without the time, but I can not get it to work with the formatting in excel.
Thanks in advance,
Kester
You could use this:
=(MID(A2,FIND(",",A2)+2,FIND(",",SUBSTITUTE(A2,",","#",1))-FIND(",",A2)-2)&"-"&LEFT(A2,FIND(",",A2)-1)&"-"&MID(A2,FIND(",",SUBSTITUTE(A2,",","#",1))+2,LEN(A2)))*1
Which is basically a bit of string manipulation (and some substitution of , to # to help) to put it in the generic format 'd-m-y h:m:s t', which excel understands, then multiply the string by 1 to force into a number (in this case 42835.58222); which you only have to format as date (important!):
Edit: Per comments, the first comma doesn't actually exist, so the revised formula:
=(MID(A2,FIND(" ",A2)+1,FIND(",",A2)-FIND(" ",A2)-1)&"-"&LEFT(A2,FIND(" ",A2)-1)&"-"&MID(A2,FIND(",",A2)+2,LEN(A2)))*1
With data in A1, in B1 enter:
=DATE(MID(A1,10,4),MATCH(LEFT(A1,3),{"jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"},0),MID(A1,6,2))
and apply desired formatting:
(this results in a genuine Excel date that can be used in sorts, calculations, etc.)(this assumes that the day field is always two digits)(if your month list is in a language other than English, edit the month list)

Question on formatting dates as text in excel

I have two sets of data. One has dates in the format Jan 10, 2020 which is stored as text. The other format is dd/mm/yyyy and is not text.
I'm trying to check if the dates are equal but I can't get it to work.
I've removed the , in the text stored date. I've tried using the Datevalue function but it just returns #value. The date function also doesn't work...
Any help appreciated.
Thanks.
Not all text strings are suitable for DateValue(). It works best when the day, month and year representation are in the order that your regional settings expect. If you are on UK settings, then you want DMY order, but the date text is in MDY order.
Therefore, you need to transform the text string into something that Datevalue() can process, for example
=DATEVALUE(MID(A1,5,FIND(",",A1)-5)&"-"&LEFT(A1,3)&"-"&RIGHT(A1,4))
This formula works for one- or two-digit days.
Format the result as date and use it for your comparison.

How to change the Date Format

I Have 1 Column where there dates are not Uniform.
I am using as a ref to derive one Column.
the date in column is
17/09/2010 i am changing the this format to 09/17/2010 by using =MID(H3,4,3)& MID(H3,1,3)&MID(H3,7,4).
But there are some dates Which are like 9/3/2007 now i want a formula to match all the dates.
Please Help me in this.
I'm assuming that, due to your regional settings, 17/09/2010 isn't recognised as a date and 9/3/2007 is recognised as March 9th, while you want September 3rd.
If you treat your input as text, you can parse it properly into a date with this formula, which I just tested:
=DATE(MID(H3,FIND("/",H3,4)+1,4),
MID(H3,FIND("/",H3)+1,FIND("/",H3,4)-FIND("/",H3)-1),
LEFT(H3,FIND("/",H3)-1))
Make sure H3 is formatted as Text, else the string functions (MID, LEFT) risk not working as expected. The cell containing that formula should be formatted as Date: mm/dd/yyyy.
why not change the cell property of the whole column to User Defined like mm/dd/yyyy

Resources