I am using Google Sheets to import a list of names and dates from a comma delimited text file. It imports fine but when I try to convert the date cells I get strange results. The dates are 8 digits long and arranged "year, month, day". for example, i have this date. 20170425 when I format it to any of the date formats I get 57124-09-13.
I've tried everything I can think of and searched forever for an answer.
Thanks so much in advance to anyone who can steer me in the right direction!
Since you've added an Excel tag, use Data, Text to Columns, Fixed Width, Next, Date: YMD, Finish.
For google-sheets, use this formula in an unused column,
=DATEVALUE(replace(replace(A1, 7, 0, "/"), 5, 0, "/"))
Related
In libre office calc I got two cells with the following content:
2022.01.10 15:51:06
2022.01.10 16:14:22
When I substract one from the other I get #VALUE!
Both cells are formatted like this "JJJJ.MM.TT HH:MM:SS"
I tried different formats and also changing the format of the output cell, but I could not get it to work.
I want the difference in hours if possible.
Thank you very much in advance for your help!
folks.
I am cleaning a dataset however in the Date row I get a strange number when I convert it do Date.
I have this:
And I get this:
What I wanted is dd-mm-yyyy.
What I tried:
I went to More Formats and manually separated the date, but it is still not recognised "Date".
I know this must be very basic, but I ave looked everywhere and couldnt find a solution.
the "date" in your D column is a string /plain text
you will need to convert it into date with helper column
=ARRAYFORMULA(IFERROR(DATE(LEFT(D2:D; 4); MID(D2:D; 5; 2); RIGHT(D2:D; 2))))
In Google Sheets, I need to create a date in the following format:
2016-06-15T12:00-0800/2016-10-16T12:00-0800
(Yesterday's date / today's date + 120 days)
Using =NOW()-1, I get yesterday's date.
Using Format - Date - More - Year(1930)-Month(05)-Day(01)T:Hour(01):00-0800, I get the proper format for the 1st part of the date range (2016-06-15T12:00-0800).
Repeating the same process with =NOW()+120.
Got the 2nd part of the date range (2016-10-16T12:00-0800).
PROBLEM: Trying to =CONCATENATE(A2,"/",B2), results in this:
42901.6965777315/43022.6965777315
...and no matter what I do - change the format, try to use =CONCATENATE(=TEXT(A2),"/",=TEXT(B2)), or other tricks I know, I either get a blank cell, an error message, or an even worse mess.
All I want is to combine 2 date cells into 1, with a slash in between. How can this be accomplished?
Try join instead of concatenate:
=join("/",A1,B1)
Maybe:
=text(now()-1,"yyyy-mm-ddThh:mm")&"-0800/"&text(now()+120,"yyyy-mm-ddThh:mm")&"-0800"
TEXT with only a date as argument returns the serial number corresponding to that date,
First you should confer the result of you formulas that involves NOW to a formatted text by using TEXT with the second argument. Then you could concatenate the result of that.
The above be donde on a single formula but you maybe should start by doing each step on separate cells in order to make it easy to check the result of each part.
I have a column full of dates in this format mmddyyyy and I was wondering if I could parse or convert it to mm/dd/yyyy. I tried selecting the entire row and then clicking on format -> number -> date but when I do this, a date such as 12082016 becomes 6/7/34979 which of course makes no sense at all. Any ideas on how to fix this?
Edit:
Examples:
7072016 12/11/2021
1202017 12/2/2017
10042016 10/4/2016
9212016 8/12/2023
I changed the B to F as that is where the date column is. What is strange is that some of the values are correct
=date(right(B2, 4), left(B2, 2), mid(B2, 3, 2))
You have to account for both 7 and 8 digit numbers. Apparently, you lost some leading zeroes when importing your data.
=date(right(right("0"&A2, 8), 4), left(right("0"&A2, 8), 2), mid(right("0"&A2, 8), 3, 2))
' or,
=--replace(replace(right("0"&A2, 8), 5, 0, "/"), 3, 0, "/")
Format the cells as mm/dd/yyy or however you wish; They are true dates now.
If you're using Google Sheets, you'll need to format the column with the number in it as 00000000 to ensure there are a full 8 digits, including leading zeroes for months less than 10. To do this, highlight the column with the MMDDYYYY numbers then from the Format menu, select Number then Custom Number Format:
Then, in the dialog box that comes up, enter 00000000 (eight zeroes) and click Apply:
Your data will be reformatted and your dates should be correct:
Hope this helps!
Date & Time values are basically series of digits, that's why it always converts it to either Date or Time, for which is formatted.
Bttr use Custom Format,, or Change the Default as u need.
If you want to convert any numbers into date,,
First write 1st date of the year convert it into number,, get the Trend,, write nXt values,, & convert into an appropriate format.
Try this formula using regular expressions:
=TEXT(REGEXREPLACE(TEXT(A1,"00000000"),"(\d{2})+(\d{2})+(\d{4})","$1/$2/$3"),"m/d/yyyy")
Change m/d/yyyy to any date format you need.
I have huge amounts of raw data that are separated by columns. All is well when i import these to Matlab except for the fact that I just saw that the excel files contains different formats for the dates.
One series (i.e 3 days, 1 row or each hour gets 3x24 rows) have its' dates in the format "mm/dd/yyyy" which neither excel or matlab recognizes as proper dates.
I've tried solving this problem in different ways. First i tried to just highlight the cells and use the function format cells, but this didn't work since excel doesn't see them as 'cells' but rather as 'text'.
Then i tried the Text to columns function which didn't work either (delimited or fixed width).
Im really stuck and would appreciate some help with this.
In Excel:
If cell A1 has a string like mm/dd/yyyy then try this:
=DATE(RIGHT(A1,4), LEFT(A1,2), MID(A1,4,2))
In Matlab:
=datenum(yourDateString, 'mm/dd/yyyy')
Select the desired range to fix and use this script:
Sub bulk_Date_fix()
on error resume next
Set d_ranged = Selection
For Each a In d_ranged
a.Value = Split(a.Value, "/")(0) & "/" & Split(a.Value, "/")(1) & "/" & Split(a.Value, "/")(2)
Next
on error goto 0
End Sub
How it works: The above script loops through all the cells in the selected area and splits out the various attributes of a date based on the "/" symbol.
I examined your file and you will need to go back to the source data to straighten this out. Instead of "opening" the file in Excel, you will need to IMPORT the file. When you do that, the text import wizard will open, and you can then designate the date column as being of the format DMY (or whatever format is being generated by the source).
The problem is that there is a mismatch between the format of the file, and your Windows Regional Short date format. If you look at Row 229, you will see that real dates are present, but out of sequence with the rest.
Excel parses dates being input according to the Windows Regional Short Date settings. If the date doesn't make sense, according to that parsing (e.g. month > 12) , Excel will interpret the date as a string; if the date does make sense, it will be interpreted as a date in accordance with that windows regional date component order, and this will be different from what is intended.
So the first few hundred dates are strings, but at line 229, the date, which is probably meant to be 12 OCT 2014, gets changed to 10 DEC 2014. This will happen in other areas where that value in the 2nd position is 12 or less.
EDIT: I am not certain of the variabilities inherent in using XL on the MAC. In the Windows version of XL, the "text import" feature is on the Data Ribbon / Get External Data Tab:
When you click on that and open a text file, you will see the Text Import Wizard, and when you get to Step 3, you will be able to specify the text format of the data to be imported: