Date format different in Actual file(CSV) and the excel file - excel

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

Related

Converting text to data Apr 06, 2020 in excel

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))

Date format in CSV file strange behaviour

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.

Excel converts document exported from google keyword tool numbers into dates

When I import document from google keyword tool some curency values are converted to date for example 5.21 is converted to May 21. However there are some in the same column that are not conveted. What should I do that my document would not be disorted ? Tried to remove text proofing when typing, however I have document prewriten by google so it dosen't help.
Your regional settings seem to have the dot in the date format, with an order of MDY, so Excel will interpret a number like 5.21 as a date, but a number like 5.66 will remain a number.
Try exporting the Google output to a text file. Then open the text file with Excel via the File > Open menu. This will bring up the text import wizard. In Step 3 of the wizard you can select each column of data and specify what data type it contains, i.e. to tell Excel what each column contains.
You regional settings may also be set to have a comma as the decimal separator. In this case, Excel will not recognize 5.21 as a number at all. You can
change the Google output to produce numbers like 5,21 or
temporarily change your regional settings to use the format Google serves you
mark the column as text and import it as text, then use find and replace on that column to replace the decimal character with the one your system uses.

CSV converting date from US to UK format only changes some, not all

I have a CSV file that contains a few date columns. It was created with the US format of dd/mm/yyyy. I need to switch those dates to the UK dd/mm/yyyy. Saving the file seems well and good. But when I reopen the file many of the dates appear without the zeros if they had one as the first digit. An example:
saved as - 03/03/2012
when re-opened - 3/3/2012
I'm using Excel 2007 and saved from xlsx to all possible CSV options (mac, windows, ms-dos..)
Anyone know why this is happening, or more importantly a solution?
For windows users, go to the control panel, pick regional and language options and pick the date format you want. In windows XP, the option for dd/mm/YYYY format only appears if you pick "English (United Kingdom)". I have not tried the export, but this fixed the import of a csv file.

Excel changes date formats

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.

Resources