Data is extracted from the application. There is a text representation of data/time as
"Wed Nov 30 2022 09:30:00 GMT+0530 (India Standard Time)" (in text)
I am required to format this column as MS data/time type, instead of text
First:
Tried custom format.. but didn't work.
not able to teach "Wed" and "GMT..." part
Second:
Tried to break the words as
=MID(A1,5,20) [it gives "Nov 30 2022 09:30:00" ]
and then apply.
=TIMEVALUE(TEXT(RIGHT(B1,8),"HH:MM:SS"))
It worked and excel was able to understand it in time format as9:30:00 AM
But, when I applied similarly the Date format as
=DATEVALUE(TEXT(LEFT(B1,11),"mmm dd yyyy"))
It gave a Value error, not sure what to do next
Finally:
Is there a way to do it in one go?
the entire column can be formatted as a valid date and time.
I took inspiration from:
[question]: Convert text date/time to a real date time in excel
[blog]: https://support.microsoft.com/en-us/office/format-numbers-as-dates-or-times-418bd3fe-0577-47c8-8caa-b4d30c528309
Kindly advise
There are many ways to do it, perhaps for now, I have tried this one,
• Formula used in cell B1
=LET(_string,TEXTSPLIT(MID(A1,5,20),," "),
_date,DATE(INDEX(_string,3),MONTH(INDEX(_string,1)&1),INDEX(_string,2)),
_time,TIMEVALUE(INDEX(_string,4)),
_date+_time)
Another way,
• Formula used in cell C1
=DATEVALUE(SUBSTITUTE(LEFT(MID(A1,5,20),11)," ",", ",2))+RIGHT(MID(A1,5,20),8)+0
DATEVALUE() wrapping not required actually,
• Formula used in cell C1
=SUBSTITUTE(LEFT(MID(A1,5,20),11)," ",", ",2)+RIGHT(MID(A1,5,20),8)
Use LET() to make it more readable,
• Formula used in cell C1
=LET(_extract,MID(A1,5,20),
_datepart,LEFT(_extract,11),
_timepart,RIGHT(_extract,8),
SUBSTITUTE(_datepart," ",", ",2)+RIGHT(_timepart,8)+0)
One more sleek way is using TEXTBEFORE() & TEXTAFTER()
• Formula used in cell D1
=SUBSTITUTE(TEXTBEFORE(TEXTAFTER(A1," ")," GMT")," ",", ",2)
Note: Since in Excel Date and Times are stored as number this will return as a number, The integer portion of the date serial number represents the day, and the decimal portion is the time, hence format it accordingly as per your need or regional settings.
Related
Is there a method to convert these column in data format? (gg/mm/aaaa hh:mm:ss)
DATE : 20220601 >>>> 2022/06/01
HOUR : 3047 >>>>> 00:30:47 (hh:mm:ss)
I have serious problem with column B, i need to convert it in (hh:mm:ss). Someone can help me?
The final result should be "01/06/2022 00:30:47"
If you have Excel 365 you can use this formula:
=LET(HourText,TEXT(B2,"000000"),
DateText, A2,
HourFinal,TIME(LEFT(HourText,2),MID(HourText,3,2),RIGHT(HourText,2)),
DateFinal, DATE(LEFT(DateText,4),MID(DateText,5,2),RIGHT(DateText,2)),
DateFinal + HourFinal)
It first takes the text-hour and the text date.
Text hour is formatted as hhmmss - to have the zeros for hour if missing. Then it is easier to return the true hour.
Adding both values (date + hour (yes this is mathematical addition) returns the date.
You can then format the date as you like, e.g. as dd/mm/yyyy hh:mm.ss
Try-
=TEXTJOIN("/",TRUE,MID(A1,{1,5,7},{4,2,2})) & " " & TEXTJOIN(":",TRUE,MID(RIGHT("00"&B1,6),{1,3,5},{2,2,2}))
For pure date value use below function then use cell format to show your desired date/time format.
=DATEVALUE(TEXTJOIN("/",TRUE,MID(A1,{1,5,7},{4,2,2})))+TIMEVALUE(TEXTJOIN(":",TRUE,MID(RIGHT("00"&B1,6),{1,3,5},{2,2,2})))
Here is an easy alternative solution, using the TEXT() Function with a Custom Formatting for Dates 0000\/00\/00 while for Times 00\:00\:00
• Formula used in cell C2
=TEXT(A2,"0000\/00\/00")+TEXT(B2,"00\:00\:00")
So, the first part of the TEXT() function returns & converts the Numbers into Dates, while the second part returns & converts the Numbers into Times, and as we know that Dates & Times are stored as Numbers in Excel, so the Integer part which represents the Dates and the Decimal which represents Times, when added to together returns a Number with Decimals using the TEXT() Function.
Hence if the cells are not formatted before then please select the cell or range and press CTRL+1 --> Format cells Dialogue Opens --> Number Tab --> Category --> Custom --> and type by removing General as dd/mm/yyyy hh:mm:ss or as per your region it will be gg/mm/aaaa hh:mm:ss
Note: For more inspiration on converting Dates when shown like those numbers, you can refer this link, I have shared a whole lot of alternatives.
CHANGE THE DATE FORMAT
I've tried a million things to get Excel to read a date that is being pulled by this formula:
=(LEFT(VLOOKUP(C7,'Input Engagement Status'!C:M,9,FALSE),11))
I use LEFT because the cell I'm referencing is storing two dates simultaneously. The output is "mmm dd yyyy".
I have tried text to columns, but the formula is being pulled apart rather than the date that it reads for.
I have tried custom formatting to create a new date format for "mmm dd yyyy". I have changed from general, to numbers, to text, and I am out of solutions at this point. Any help would be greatly appreciated.
A way to illustrate the differences is with a date on the worksheet. Excel treats dates as 1 for every day past Dec 31, 1899. Today happens to be 42,192 (or 42192 as Excel sees it).
If you put =TODAY() in a cell (e.g. A1) and use =RIGHT(A1, 2), the A1 cell probably shows 07/07/2015 but the underlying value is 42192 so the RIGHT(A1, 2) is going to return 92. Format the cell so it displays Tuesday, July 7, 2015 and RIGHT(A1, 2) is still going to return 92.
If you have two dates in the same cell separted by a space or other delimiter as a text string then you should be able to pull the first 11 characters from the string value and convert it back to a date with the DATEVALUE function.
Using this data in a single cell (A1):
Jul 07 2015 Jul 15 2015
Use the SUBSTITUTE function to insert a comma so that DATEVALUE will resolve the date correctly.
=DATEVALUE(SUBSTITUTE(LEFT(A1, 11), " 20", ", 20"))
=DATEVALUE(SUBSTITUTE(RIGHT(A1, 11), " 20", ", 20"))
Format the result as a date. The above will return 42,192 and 42,200 (the number of days since Dec 31, 1899). Format as a date to get something like 07/07/2015 and 07/15/2015.
You should be able to transcribe your VLOOKUP function into that simple example.
In MS Excel 2013 I import a CSV file, no matter if I format it using the delimined or any other option the results are the same. My date in Excel looks like: 30 Jan, 15 18:02:05 in a single cell. All I need is to convert it to a date format 30.01.2015 for example. I have a column of these and need to convert the values at once. (I tried TEXT, DATE, MID, DATEVALUE, MONTH, DATEVALUE...) but none of them are able to convert the date format. Also it does not matter if I convert it with format cells...to date it always displays the same i.e. 30 Jan, 15 18:02:05
Not sure what I am doing wrong. Getting a bit frustrating, thanks for any advice. Most of the above give a #VALUE error.
With data in A1 in B1 enter:
=DATEVALUE(LEFT(A1,FIND(" ",A1)-1) & "-" & MID(A1,FIND(" ",A1)+1,3) & "-20" & MID(A1,FIND(",",A1)+2,2))
and format B1 as dd.mm.yyyy for example:
The scenario I have is as follows:
Cell A1 - contains the name of the current month, e.g. "October"
Cell A2 - contains the value of the current year, e.g. "2014"
Cell A3 - contains the value of a given day, e.g "22"
I'd like to populate A3 with a formula that will give it the value 22 October 2014 and have this formatted as a date so I can perform comparisons and calculations in other cells - so along the lines of 22 + A1 + A2. I've tried using the CONCATENATE function but this doesn't let me format the cell as a date.
Is something like this even possible using the standard Excel functions?
You're looking for the DATEVALUE function. It can convert month names into a numerical date expression, which you can then format as a date (dd/mm/yyyy in the example below).
=DATEVALUE(A3 & " " & A1 & " " & A2)
As a bonus, this will also work if A1 contains short-form month names i.e. Jan, Feb, Mar, etc.
I just did a bit of testing, which showed that you can also drop the " " space delimiters entirely:
=DATEVALUE(A3&A1&A2)
In fact, just using -- to force Excel to treat the concatenated string as a numerical value works as well!
=--(A3&A1&A2)
So far, my testing has not found any instance where -- doesn't work as well as DATEVALUE. Leaves me wondering what the point of DATEVALUE is.
Try this:
=DATE(A2,MATCH(A1,{"January","February","March","April","May","June",
"July","August","September","October","November","December"},0),A3)
You can also use this formula
=(A1&A2)+A3-1
format result cell in required date format
I have an Excel file which is exported from a Access database.
I have 25000 records and I will need to replace all of them.
The date column is not formatted (yymmdd). I need to change the date format from yymmdd to dd/mm/19yy. For the yy I need to add a constant value 19 in front of it so it would be 19yy.
I have only 1 date column per row
Is there any way to convert all the 25000 record's column formatted in yymmdd to dd/mm/19yy in a few clicks?. Thank you
This will give you the result as an actual date which you can then format as you wish using Excel's date formatting options.
=DATE(1900+LEFT(A1,2), MID(A1,3,2), RIGHT(A1,2))
If you don't need to parse it into a date value, but merely need to display a date in the format you identified, the following will work on a value in cell A1 (copy down to the rest of the 25,000 values as needed:
=RIGHT(A1,2) & "/" & MID(A1,3,2) & "/19" & LEFT(A1,2)
In my cell A1, I entered the value 981116. This formula converted it to 16/11/1998. I think that's what you're looking for, right?
Assuming data starts at A2 put this formula in B2
=(19&TEXT(A1,"00-00-00"))+0
Now format B2 in required date format, e.g. mm/dd/yyyy
and you can easily "fill down" all 25000 rows by doing this:
put cursor on bottom right of B2 (first cell with formula) until you see a black "+" - that's the "fill-handle" - double click and the formula will populate as far down as you have continuous data in the adjacent column
Note: you can probably omit the 19& if all your dates are after 1930 because the default is to treat any date written without the century as 1900s if it's >=30 or 2000s if it's <30 [although you can change that in regional settings]