Excel - Convert date from yymmdd to dd/mm/yy - string

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]

Related

There is a method to convert these column in data format?

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

change date format m/d/yyyy to dd/mm/yyyy using formula

sr date date-text mm dd yyyy concat(dd,mm,yyyy)
1 12/31/2018 12/31/2018 12 31 2018 31/12/2018
2 3/31/2019 3/31/2019 3/ 1/ 2019 1//3//2019
as shown above i have some dates in col 'date' formatted as m/d/yyyy. i need to convert this to dd/mm/yyyy. i tried DATEVALUE funtion but it gives value error as my pc date format is dd/mm/yyyy. Unfortunately i cant change my PC date format.
So i tried to split the date using LEFT,MID and RIGHT function.
date-text = TEXT([#[date]],"mmm/ddd/yyyy") - to fix date format to mm/dd/yyyy
mm =LEFT([#[date-text]],2)
dd =MID([#[date-text]],4,2)
yyyy=RIGHT([#[date-text]],4)
concat(dd,mm,yyyy) = =CONCAT([#dd],"/",[#mm],"/",[#yyyy]) to get mm/dd/yyyy for mat.
This approach works for row 1 but for row 2 i get wrong date "1//3//2019". please let me know how to fix this
Try following formula
=DATE(RIGHT(A1,4),LEFT(A1,SEARCH("/",A1)-1),TRIM(MID(LEFT(A1,SEARCH("/",A1,SEARCH("/",A1)+1)-1),SEARCH("/",A1)+1,2)))
You can get the result you want with just one formula:
=DATE(VALUE(RIGHT(A2;4));VALUE(MID(A2;1;FIND("/";A2;1)-1));VALUE(MID(A2;FIND("/";A2;1)+1;FIND("/";A2;FIND("/";A2;1)+1)-FIND("/";A2;1)-1)))
I understand very well your situation. I'm from Portugal and here we have the same date format as you (dd/mm/yyyy). Pay attention to your pasted values as a "date". For instance, if you place 3/31/2019 Excel won't recognize it as a date and paste it as text (that's why you don't need your date-text column). However, if you paste 1/12/2019 Excel will write automatically 01/12/2019 when the true date is 12/01/2019 and the formula will not work.
Simplest way for me is to use text to column function. select m/dd/yy dates and go to "Data" select text to column function located in "data tools". This enables the Text Wizard - select the delimited button. hit "next". Step 2 wizard box appears which is where you choose your delimiters. remove any ticks except for "Other" and tick this box. Click "Next". Step 3 of 3 box appears. IMPORTANT Choose your destination carefully. Ideally select a blank cell at the end of your existing data. In this way the results of the text to data function can be freely edited. If you have selected your original data correctly every cell will transpose as m - dd - yyyy. Cut and paste the year to its RH adjacent column and transpose the "m" to the blanks cells that were occupied by the "yyyy". Now you'll have 3 columns "dd", "mm", "yyyy". with a Blank column where the "m's" were. Select the blank cell to the left of the first row of transposed data. Enter the formula "=VALUE(ddcell&"/"&"mm"cell)
you should get a result of 1/01 (if that's the date your modifying). If the current year is 2022 then that will be added automatically. If not you'll have to modify your formula to include the date you want. If the result shows just a number go to your home tab and then number options. Select "Short Date" and it will all happen. With some practice this procedure is a breeze and saves writing those long messy formulas.
Good luck from Henry

Excel convert date to text retaining date layout

I have rows containing every Monday and Sunday in an entire year, (with variations on when a month starts and ends) like so,
11/05/2015 18/05/2015 25/05/2015 01/06/2015 08/06/2015
17/05/2015 24/05/2015 31/05/2015 07/06/2015 14/06/2015
However these are in the date format, and I need them in a text format, but so they still read in the dd/mm/yyyy format, not like 42125.
Further up my document, each column header should read dd/mm/yyyy-dd/mm/yyyy using each of the dates shown in my first example, and I was hoping to achieve this using the formula =A30&"-"&A31 and so on. So the desired outcome should read,
11/05/2015-17/05/2015 18/05/2015-24/05/2015
11/05/2015 18/05/2015
17/05/2015 24/05/2015
However using the =cell&cell formula im left with
42135-42141 42142-42148
11/05/2015 18/05/2015
17/05/2015 24/05/2015
I have to create these headings for 2 years worth of dates, and trying to avoid typing every heading out manually, is there a way to achieve this?
Use the TEXT function which comes with Excel.
Assuming cell A1 has "11/05/2015", use the following formula in cell B1:
B1=TEXT(A1,"dd/mm/yyyy")
This takes care of the first part of your question. For the second part, you can use the CONCATENATE function. Assuming that B1 and B2 contain dates as text, you can join them together using the following formula:
=CONCATENATE(B1, "-", B2)
Try converting those values to text before concatenating:
=TEXT(A1,"dd/mm/yyyy")&"-"&TEXT(A2,"dd/mm/yyyy")
You need to break them down like so:
=DAY(A3)&"/"&MONTH(A3)&"/"&YEAR(A3)&"-"&DAY(A4)&"/"&MONTH(A4)&"/"&YEAR(A4)
I am assuming here your data start from cell A3
Assuming headings in row 1 and dates in rows 3 and 4 this will work:
=TEXT(A3,"dd/mm/yyyy")&TEXT(A4," - dd/mm/yyyy")
without having to concatenate " - "

Concatenate and preserve format in excel

I have Excel table when one cell has 'text' formating and literally is A1 ABC: and second cell is custom formatting and literally is B1 2013-11-4
I need in the third cell C1 to concatenate both and get ABC:2013-11-4
I tried this: =concatenate(A1,A2) but it resulted in ABC:41582
My question: how could I concatenate A1 and B1 in order to keep custom formating of B1 cell?
Thanks
You have to set the date format within the concatenation. The concatenation is retrieving the value behind the cell.
Instead, you can easily specify the date format using TEXT(cell, format):
=CONCATENATE(TEXT(A1,"YYYY-M-D"),A2)
The YYYY, M, and D represent four digit year (2013), month (11), and day (4) respectively.
The Answer provided by grovesNL fixed my problem.
Ticket could be closed.

Get date value based on month name

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

Resources