![]() |
|
|
#1 | ||
|
Morgado's Favorite Forum Fascist
Join Date: Oct 2000
Location: Greensboro, NC
|
Excel Question
I need to help someone who has a csv file that has dates in it, formatted as MMDDYYYY (04262007). I need to be able to go in and edit the file, but it is critical that the dates retain the leading zeros. The files that will need to be edited will have hundreds of rows, and 190 columns, so opening it with Notepad as a text file is completely impractical. The best-case scenario here would be for a way to configure Excel so that the default field format is "Text", rather than "General."
Help?
__________________
The media don't understand the kinds of problems and pressures 54 million come wit'! |
||
|
|
|
|
|
#2 |
|
College Prospect
Join Date: Nov 2000
Location: Gothenburg, Sweden
|
Do you have any way of affecting how the csv-file is written? Having "" around the "datefield" would indicate to Excel that it's a text-field I would think.
Other than that, when you open the file, is it immediately put into columns or are you faced with all data inside one column and you have to do "Text to Columns"? If it's the latter, you have the chance to indicate what datatype a particular column is.
__________________
IFL - Vermont Mountaineers ~ I am an idiot, walking a tight rope of fortunate things ~ |
|
|
|
|
|
#3 | |
|
Hall Of Famer
Join Date: Nov 2000
Location: Behind Enemy Lines in Athens, GA
|
Quote:
Maybe I'm making this simpler than it actually is, but if this is the optimum scenario, the third step of the import wizard allows you to define a column as text rather than general. (I'm assuming that this csv is consistent & is ready for an easy import into Excel, and that the field with the leading zeroes needed is consistent across the entire file).
__________________
"I lit another cigarette. Unless I specifically inform you to the contrary, I am always lighting another cigarette." - from a novel by Martin Amis |
|
|
|
|
|
|
#4 | |
|
Morgado's Favorite Forum Fascist
Join Date: Oct 2000
Location: Greensboro, NC
|
Quote:
No. I have no control. It is written by a third party. To answer JIMGA's question, I don't get the wizard. It just opens straight up in Excel. The best workaround so far is to change it to .txt, then use the wizard to import in Excel, and change the format of that field. However, my hope is that there's some global setting in Excel that can be changed to do this before the file has to be opened.
__________________
The media don't understand the kinds of problems and pressures 54 million come wit'! |
|
|
|
|
|
|
#5 | |
|
Hall Of Famer
Join Date: Nov 2000
Location: Behind Enemy Lines in Athens, GA
|
Quote:
All I can say on that is that, if there is, I've never noticed it.
__________________
"I lit another cigarette. Unless I specifically inform you to the contrary, I am always lighting another cigarette." - from a novel by Martin Amis |
|
|
|
|
|
|
#6 |
|
College Prospect
Join Date: Nov 2000
Location: Gothenburg, Sweden
|
What happens if you Open the file through Excel's File->Open menu rather than double-click on the file? Don't you get the import-wizard then?
__________________
IFL - Vermont Mountaineers ~ I am an idiot, walking a tight rope of fortunate things ~ |
|
|
|
|
|
#7 |
|
Morgado's Favorite Forum Fascist
Join Date: Oct 2000
Location: Greensboro, NC
|
No. It opens right up.
__________________
The media don't understand the kinds of problems and pressures 54 million come wit'! |
|
|
|
|
|
#8 |
|
Pro Rookie
Join Date: Feb 2003
Location: Raleigh, NC
|
Well, another way would be to open it up in Excel, then select the column with the date information, then go into the column's "Format Cell" properties and select "Custom" format for the "Number" and then type in the date/time format you like, e.g. "mm/dd/yy hh:mm:ss AM/PM" in the box available, then save. Excel tends to want to force such numbers into a default format of some kind, so this is a way to get around that. You'd probably need to save as an Excel file to retain the formatting, however. Otherwise, you'll need to re-apply the format change every time you open the CSV.
|
|
|
|
|
|
#9 |
|
FOBL Commish
Join Date: Oct 2000
Location: Team Radii
|
Open Excel.
Go to Data --> Import External Data --> Import Data. Select your file. You should get the wizard. |
|
|
|
|
|
#10 |
|
College Prospect
Join Date: Nov 2000
Location: Gothenburg, Sweden
|
What about this:
1) Open Excel, empty spreadsheet before you 2) Go to Data->Import External Data->Import Data 3) Select Textfiles and CSV files and open your file Any luck?
__________________
IFL - Vermont Mountaineers ~ I am an idiot, walking a tight rope of fortunate things ~ |
|
|
|
|
|
#11 |
|
College Prospect
Join Date: Nov 2000
Location: Gothenburg, Sweden
|
Simms stole my thunder!
__________________
IFL - Vermont Mountaineers ~ I am an idiot, walking a tight rope of fortunate things ~ |
|
|
|
|
|
#12 |
|
n00b
Join Date: Mar 2001
Location: Texas, USA
|
If the cells that are "formatted as MMDDYYYY (04262007)" are contained in the same column, you can do the following;
1. import into excel 2. In a temporary new column at far left of your spreadsheet, you will enter a formula that you will fill down: =text([click on cell in same row with date reference],"00000000") 3. After filling down the formula, select the entire new column with the new formula entries (from top cell thru bottom); copy. 4. Now select the top cell of the column where the original date entries are and do a paste special/values. 5. Finally, delete the formula column and save your spreadsheet. There is probably an easier way, but this will work. |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|