I have some dates in my excel spreadsheet that have th,nd,st and rd in the string so I am currently struggling to convert them to a date format of dd/mm/yyyy.
How would I be able to do this using a formula?
28th April 2017 = 28/04/2017
Thanks
The text being in A1:
=DATEVALUE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"th",""),"st",""),"nd",""),"rd",""))
With a formula:
=--(LEFT(A1,MIN(SEARCH({"th","st","nd","rd"},A1 & "thstndrd"))-1)&" " & MID(A1,MIN(SEARCH({"th","st","nd","rd"},A1 & "thstndrd"))+3,LEN(A1)))
This is an array formula and needs to be confirmed with Ctrl-Shift-Enter.
Then format as dd/mm/yyyy
You could give a try with this formula as well,
=IF(ISNUMBER(VALUE(LEFT(A1,2))),TEXT(REPLACE(A1,3,2,""),"mm/dd/yyyy"),TEXT(REPLACE(A1,2,2,""),"mm/dd/yyyy"))
The formula finds the numeric value in first two places and formats the date accordingly. The advantage of this formula is, you can modify the mm/dd/yyyy format as per your needs. There would not be a necessity to change the format of the cell.
Related
I have 2 text as below want to convert to date in excel
2/10/2001 4:00:00 AM
2/10/2001 12:30:00 PM
I tried =DATEVALUE() and TEXT(A1, "mm/dd/yyyy hh:mm") in excel which returns me error
I also tried to calculate these 2 dates which also return me error
Try below formula
=TEXT(--LEFT(A1,SEARCH(" ",A1)-1)+(--MID(A1,SEARCH(" ",A1)+1,100)),"mm/dd/yyyy hh:mm:ss AM/PM")
This simple formula should also work- format the resulting cell as mm/dd/e hh:mm:ss AM/PM
=TRIM(DATEVALUE(A1))+TRIM(TIMEVALUE(A1))
FILTERXML() will also work.
=TEXT(SUM(FILTERXML("<t><s>"&SUBSTITUTE(TRIM(A1)," ","</s><s>")&"</s></t>","//s[position()<3]")),"mm/dd/e hh:mm:ss AM/PM")
I'm not sure I understand the question. When you enter those values into a spreadsheet, Excel understands them as date/time values. No conversion is necessary. You can perform date/time arithmetic on them as is.
Cell A1 & B1 show the values I copied from your question and pasted into the worksheet. C1 shows the time interval in hours.
Currently, I am using the EDATE function in cell A5.
It is displaying the date as "February".
I want this "February" to be displayed as "FEBRUARY". (simple change to upper case)
How can I do this whilst keeping the formula currently in cell A5?
Cell A5 formula : =EDATE(A4,1)
=PROPER(TEXT(EDATE(A4,1),"MMMM"))
If your cell content doesn't need to be a numeric date. Means you don't calculate with this cell and it is just for displaying purpose, then use the following formula
=UPPER(TEXT(EDATE(A4,1),"MMMM"))
Use a font which is all capitals e.g.Perpertua Titling MT
Otherwise conditional format
dd \F\E\B\R\U\A\R\Y yyyy
with custom formula
=month(C1)=2
and so on for all 12 months.
=UPPER(TEXT(EDATE(A4,1),"dd MMMM yyyy"))
This works quite well when using other date functions like e.g. EOMONTH
What formula should I try to use to convert date:
Cell A1 = 01/07/2018 00:02:05
to
07/01/2018
I'd just change the date format of the cell Format > Date and find that format, or enter mm/dd/yyyy as a custom format. If you absolutely must use a formula then use TEXT() like so:
=TEXT(DATE(2018,7,1),"mm/dd/yyyy")
The day is missing so it just needs to be first of the month so:
11/17 would be 11/01/2017
Is there a formula that can do this?
There is two approaches:
Set the Category type of the cell (in Format Cell) as Custom and define this format in Type field: mm/dd/yyyy
In case of the format cell is text (working with string)
Assuming the validate entered in cell A1, use below formula:
=LEFT(A1,2)&"/01/"&IF(LEN(A1)=8,2,20)&RIGHT(A1,2)
This is probably a stupid formula but it worked for me;
=DATE(100 + RIGHT(TEXT(A6,"MM/YY"),2),LEFT(TEXT(A6,"MM/YY"),2),1)
Try it out it takes the existing "MM/YY" format and converts it to a MM/DD/YYYY date using the date foromula =DATE(Year,Month,Day). It works if the date is in date format or text format.
I have entered the date in the excel as 19.04.2015 but now I want the "." in these dates to be replaced with "/", so that the output should be 19/04/2015
Does anyone know the formula for this?
Tutorial to change the date format. The way you should do it is change the data type to date on fields with date then modify date display format.
With data in A1, in B1 enter:
=DATE(RIGHT(A1,4),MID(A1,4,2),LEFT(A1,2))
and apply the correct format to B1
You have to set the cell format to Custom Format using TT/MM/JJJJ