I have a .csv file that is created generated using some legacy software. There is no way to look inside the code at how or what its doing to produce the csv file.
My issue is that the date field format is behaving strangely.
The .csv file is storing the date in the following format.
MM-dd-yyyy HH:mm:ss.SSS
Looking in the file in notepad (raw data) we get a list of columns like this:
"01-12-2013 14:23:38.000",146.199997
"01-12-2013 23:20:29.000",146.199997
"01-13-2013 17:59:23.000",152.299988
"01-13-2013 18:08:40.000",147.300003
"01-13-2013 18:25:52.000",156.000000
"01-13-2013 18:35:14.000",146.300003
"01-13-2013 18:44:56.000",148.500000
"01-13-2013 18:56:41.000",151.699997
NOTE: I have stripped out the remaining columns to make it easier on the eye so we are only seeing the first 2 columns in the .csv file.
Now when I open this file in Excel 2010 version 14.0.6023.1000 (32-bit) I get date format problems.
Firstly if I just open the file I get blocks of mixed date formatting like this:
And this:
I can see that Excel is getting confused when the day value is switching from 12 to 13. If i then try to change the formatting to fix the issue using the following cell formatting settings:
Then I get the following displayed in the column when the day is less than 13:
And the following format when the day is greater than or equal to 13:
Any help would be really appreciated on this as I am now completely out of ideas.
NOTE: I have also tried copying the contents of the .csv file into another file but the same things occur in the new file.
This problem is to do with how Excel is interpreting the date format (M/D/Y vs. D/M/Y). It appears your system is setup for D/M/Y date formats. You won't find the setting in Excel because it derives it from your system settings. Go to the Language settings and add US English. Then set it to default and try opening the CSV file again.
Alternatively you can paste the csv file contents into a new sheet and use the 'Text-to-Columns' feature, which will let you specify the date format.
You have a conflict between the format of the .csv and your Regional settings.
First import the data as Text,(rather than double-clicking). Then in B1 or some other column enter:
=DATE(MID(A1,8,4),MID(A1,2,2),MID(A1,5,2))+TIMEVALUE(MID(A1,13,8))
and apply the desired formats:
I found a work around for my instance after reading the answers from #Gary's Student and #hughg. Thanks for the ideas.
So to fix my issue:
Modified my regional settings for dates and times to US.
Opened the file as normal in excel.
Selected the column in question and formatted cells into text. This converted all the dates in the file into floating point numbers.
Finally Apply following custom format to the cells: dd/mm/yyyy hh:mm:ss
The result is that every date in the file is now correctly formatted into UK date format.
Related
I need help in converting this text value exported in text format from software management tool "Apr 06, 2020" to data format.
I have tried various methods like text to columns then picked all of the possible data formats but nothing works. Can you please help or suggest any solution?
Your problem is a mismatch between your Windows Regional Settings (which Excel relies on in order to parse your date), and the date format in the exported file (which appears to be US-English).
You have several choices:
If the file exported from your management tool is a text or csv file, you can probably use Power Query to import the file. Select Transform then right click on the Date column and select Change type => Using Locale => and select Date and English-US.
You could change your regional settings to English(united states) while you do the import, then change them back.
If none of the dates get converted, you could try this formula:
=DATE(RIGHT(A1,4),MATCH(LEFT(A1,3),{"Jan";"Feb";"Mar";"Apr";"May";"Jun";"Jul";"Aug";"Sep";"Oct";"Nov";"Dec"},0), MID(A1,5,2))
Note that in the formula, you may need to change the commas to semicolons, or whatever your country uses to separate formula arguments
You can use below formula, Where A1 is date cell
=DATEVALUE(MID(A1,5,2)&"-"&LEFT(A1,3)&"-"&RIGHT(A1,4))
I am struggling with the different cell formatting types in Libre Office - I am aware of the manually adjustable Date formatting, but cant get Libre Office to recognise an input text string like:
" Wednesday, December 11, 2013 13:27"
where everything between the quotes is the cell content. Obviously I want the software to recognize, that this is a date and thus make a graph out of a large table, but using a manual formatter like:
" NNNN, MMMM D, YYYY HH:MM"
does not result in what I want, ie. the cell accepts my manual format but still cant cope with the content. What am I doing wrong? - any tips how I can nevertheless produce a graph with x-values with dates in this format? I dont want to awk around and manually convert these strings each time I have such a table...
Thanks a lot!
Be aware that during the import process you have a chance to set the date format during this import routine in Librecalc. Find this and use it.
I found that the fix must come while opening a CSV file to avoid being down the rabbit hole of errors and frustrations.
The preview of data on open is interactive. Who knew? :o
Do this:
Open
Select columns with dates in the preview
Change setting from Standard to Date in the dropdown
I have a csv file with a date and time field.Now if the CSV file is opened in textpad or notepad++ the time format is 24 hrs but if the same is opened using excel (2007) it is is 12 hr format. For example if it is 6/4/2012 15:00:00 in the csv file then it is 6/4/2012 3:00:00 PM
The format cell options is also not helpful.
I want the same format in excel.I think i am missing some internal settings
Following would help you if you wish to format time in Excel
On the cell, right click and go to Format Cell
There will be a tab labeled Number (the first one)
select the appropriate Category from the list (Time, in yor case)
choose one of the formats listed. (one of the bottom two, at least in Office 2003)
If none of the formats matches what you want, select one that is close to what you want, then choose the Custom category. You can now edit the format however you choose using the format you chose to customize and the other pre-defined custom formats as a guide
An other option is to import the csv into Excel from Data > From Text then go through the wizard and import the columns as text (on step 3 of the wizard) and then excel should not change the format
i have problem with excel changing the date format so it fits regional settings.
my problem is:
i am creating tool in which user chose which *.csv file to import and work with. While tool is on user side i can't rely on regional setting - tool have to work for all.
Problem is that excel automatically change date format to fits regional setting and therefore it is wrong or i can't parse it with static delimiter (like '/').
I know the format in which the date is written in the csv file (yyyy-mm-dd or dd/mm/yy) and i would like to read that date as a text so i can use DateSerial to create correct date.
Is there any way to read csv only as text and prevent excel from changing it to date (based on user regional settings) automatically ?
Thank you.
When importing, specify the column as text.
Or, put an apostrophe at the start of each date value. This is the "this is a text value, don't reformat it" symbol.
example
123,'12/29/1999,blah blah
I run a process to produce a rather large CSV file of data. Sometimes I find it helpful to open the CSV in excel, make changes manually, and then re-save. However, if there are dates in the CSV, excel automatically reformats them. Is there a way to prevent excel from doing this? It would be helpful if I could turn off all text formatting altogether.
If you prepend an apostrophe ' to the beginning of any date string during the export process, Excel will read the value literally (i.e. as plain text) rather than trying to convert it to a date.
This particular solution is handled during the export process. I'm not sure how you would change Excel to treat the file differently at runtime.
Excel does some nasty tricks when outputting XML. One of its tricks is to drop left most column delimiters if 16 or so consecutive rows have no values for these columns. This means that if you're splitting the lines up based on commmas then these rows will have a different number of columns to the rest.
It will also drop any initial 0's so things like numeric Ids can become messed up.
Another risk you run is chopping the file off short since Excel can only support a maximum number of rows. (Prior to Excel 2007 this was around 65536)
If you need to do anything to a CSV file other than read it use a text editor.
When you import the CSV file into Excel, be sure to pre-format the date column as text. There's a frequently overlooked option in the parsing that allows you to control the format column by column. This also works well for preventing the leading zeros in New England ZIP codes from getting dropped in your contact lists.
If you used the excel file version which is 2010 or later (not sure lower version), you can set up to use current operation-system date format or not in Excel/CSV file.
Right Click cell with date value (e.g. '9/12/2013') in CSV file and pop up the menu
Click 'Format Cells' and open a pop up screen
Go to 'Number' tab and you can see 'Date' was selected in 'Category' (left side) and 'Type' on the right side
Observed that there are two types of Date format (one is with () and another is not with ()). Read the comment there and you can find that you can use the date format which is not with date. It means that your changes to the CSV file will not be applied with your current operation-system date format. So, I think date format won't be changed in CSV file in this case.