Excel formula change to m/d/y - excel

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")

Related

How to convert MM/YY to MM/DD/YYYY in Excel (missing day)

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.

Excel convert TEXT (28th April 2017) TO DATE

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.

Changing date format in Excel

I have this Excel data:
Using this formula:
="select '"&J4&"_"&H4&"', DATE '"&K3&"', DATE '"&K4&"' union all"
I get:
But I need both dates in this format:
I bolded the format of date I need. Thanks!
Use Text formula:
Text(K3,"YYYY-MM-DD")
So &K3&
Becomes
&Text(K3,"YYYY-MM-DD")&
Do same for K4
Could you use the functions YEAR() MONTH() and DAY() then put them in the format you want?
If k3 has the date, then YEAR(k3) will give 2017 etc
Substitute &K3& for the following:
&SUBSTITUTE(K3,"/","-")&

Excel Date formatting replace "." with "/"

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

How to concatenate date(mm/dd/yyyy) with time (hh:mm:ss) using VBA

I have two cells: A1 and B1
A1 has data in format of mm/dd/yyyy
B1 has data in format of hh:mm:ss
When I concatenate the two cells A1 and B1 using VBA, the output contains has the format mm/dd/yyyy hh:mm. Why are the seconds not displaying? How can I fix this?
Note :
a) After concatenation the output is copied to A1.
b) I tried changing the format of date to dd/mm/yyyy, in this case its working fine .
It's hard to tell what you are doing exactly without seeing your code, but I think you are specifying the format of the value you are writing to cell A1: using the VBA Format function you are converting the date-time into a string.
However, to change the way the date is displayed in a cell, you need to change the format of that cell itself (not the format of the value written to it). Otherwise Excel will likely interpret the value in the cell and snap it back to the specified number format for that cell.
You can change the cell's format in the Excel 2010 window like this: Home > Number > Custom > Type: mm/dd/yy hh:mm:ss
Or, using VBA:
Range("A1").NumberFormat = "mm/dd/yy hh:mm:ss"
Try to change the format of C1 to
mm/dd/yyyy hh:mm:ss

Resources