Convert "flat" datetime using Excel's format options - excel

I have received an Excel file that contains a number of datetime fields in the following "flat" format:
20150901120844
I need to convert this to a more useful value such as "2015-09-01 12:08:44" using Excel's formatting options.
How can I achieve this?

There is no formatting option that will adjust your dates for you, in this case.
But you can use a formula in an adjacent cell to reorganize the data into the date / time text you desire.
Let's say that 20150901120844 is in cell A1. Then in B1 you could enter this formula:
=LEFT(A1,4) & "-"& MID(A1,5,2) & "-"& MID(A1,7,2) & " "& MID(A1,9,2) & ":"& MID(A1,11,2) & ":"& MID(A1,13,2)
It will result in this value in cell B1: 2015-09-01 12:08:44.

Related

Excel Date convert

I have date column like this
DEC07
SEP2007
SEP2008
JUN10
JUN09
how can I can convert this into MM/YYYY assuming DEC07 is 12/2007?
With data in A1, in B1 enter:
=MONTH(DATEVALUE("1 " & LEFT(A1,3) & " 2000")) & "/" & IF(LEN(A1)=5,2000+RIGHT(A2,2),RIGHT(A1,4))
and copy down.
The formula will handle both 2-digit years and 4-digit years.
This converts it to an actual date and not a string that looks like a date:
=IF(LEN(A1)=5,--REPLACE(A1,4,0,"20"),--A1)
Then format the cells:
mm/dddd

Excel date functions

I'm trying to get the current year/month/day military time in a cell. This is exactly what I need in the cell #Date:2017/AUG/14 14:55:08 I know this is super easy to do but I'm just not getting the result that I want. This is what I tried.
="#Date"=date(yyyy,MMM,D, hh:mm)
If you're after VBA:
="#Date:" & Format(now(),"yyyy/MMM/D hh:mm:ss")
If you're after a cell formula:
="#Date:" & TEXT(NOW(),"yyyy/MMM/D hh:mm:ss")
Note: Consider DD instead of D if you want day 1 to read 01 instead of 1
Just enter:
=NOW()
in a cell and custom format as "#Date:"yyyy/mmm/dd hh:mm

How to change a date type to short date

How would you change this date type Monday, 31, August2015 at 6:08 AM to short date in Excel 31/08/2015 ?
Currently I use Text to Columns on the top date, find and replace to remove the comma on 31,. Then use a combination of =text(1,"00") and =month(A1&1 to format the numbers correctly and finally =concatenation() to join them all together.
This is time consuming and concatenated dates are in a different format to short date formats. When uploading data the software will see them as such.
I'm hoping there is a really easy way of doing this to save time.
It's a long formula, but it works. Before using it make sure you set the Number Formatting for the formula cell to the short date that you want.
Assuming that your awkward date is in cell A1, enter this formula in another cell:
=DATEVALUE(VALUE(SUBSTITUTE(MID(MID(A1,FIND(" ",A1)+1,99),1,2),",","")) & " " & MID(A1,FIND("|",SUBSTITUTE(A1," ","|",2))+1,3) & " " & MID(A1,FIND("|",SUBSTITUTE(A1," ","|",3))-4,4))

How do I keep the date in a formula?

I'm attempting to create a date range in a merged cell with the following:
=(A1-1) & "-" & (A1-6)
So I'm referencing a date that I have in a cell (A1) and subtracting a few days from it. Once I try to do this it returns the following:
41914-41909
I'd like to be able to keep the dates in the following format:
1/1/2014 - 1/7/2014
How would I do this?
You just need to convert the dates to text before trying to concatenate them as a string.
=TEXT(A1-1, "mm/dd/yyyy") & " - " & TEXT(A1-6, "mm/dd/yyyy")
Here's a similar question on StackOverflow: Convert date field into text in Excel. It gives a little more detail if you have any problems.

Using Today() and Mid in excel

Excel cell should have the below value
ABC,04-04-2014
the date entered shouldn't be hard coded.
I need it by using
Today() or some other function.
Either:
="ABC," & TEXT(TODAY(),"dd/mm/yyyy")
or
="ABC," & TEXT(TODAY(),"mm/dd/yyyy")
depending on your desired date format.

Resources