Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
JMay
 
Posts: n/a
Default CSV file Imported to Excel

I rec'd a CSV file today @ work. From Excel I did a File, Open and it opened
immediately (without the File Open Wizard which I was hoping for). Anyway,
everything LOOKED fine in the Range of numbers between B2 and K30 - with 20 or
30 blank cell among the numbers; I later
found out the blank cells WERE NOT Blank, but rather had 13 hard-coded space
characters in them.

I later opend the file in Word Pad and saw how that it appeared something like
as follows:

4344.56, 3232.56, , 555.55,

Where in excel it was:
B C D E
2 4,344.56 3,232.56 "13spaces" 555.55

This situation SHOULD be corrected before it gets to the end user, but what
should be done to eliminate the fields creating the 13 spaces versus a null
string ""?
Thanks in advance,,
Jim


  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default CSV file Imported to Excel

I think I'd try to fix the problem before it got to excel. Maybe you could go
back to the sender and ask them to change the way they create the file.

If that's not possible, then (maybe) just open the file and do edit|replace.
Replace a space character with (leave blank).

If you have actual words in any of the fields that are separated by spaces, this
is not a good idea.

But maybe you could just select the range to change first, then do the mass
change.

If worse came to worse, you could always cycle through the usedrange.

dim myCell as range
for each mycell in activesheet.usedrange
if trim(mycell.value) = "" then
mycell.clearcontents
end if
next mycell

===
Or just run David McRitchie's TrimAll (that may fix other problems as well):
http://www.mvps.org/dmcritchie/excel/join.htm#trimall
(look for "Sub Trimall()")

JMay wrote:

I rec'd a CSV file today @ work. From Excel I did a File, Open and it opened
immediately (without the File Open Wizard which I was hoping for). Anyway,
everything LOOKED fine in the Range of numbers between B2 and K30 - with 20 or
30 blank cell among the numbers; I later
found out the blank cells WERE NOT Blank, but rather had 13 hard-coded space
characters in them.

I later opend the file in Word Pad and saw how that it appeared something like
as follows:

4344.56, 3232.56, , 555.55,

Where in excel it was:
B C D E
2 4,344.56 3,232.56 "13spaces" 555.55

This situation SHOULD be corrected before it gets to the end user, but what
should be done to eliminate the fields creating the 13 spaces versus a null
string ""?
Thanks in advance,,
Jim


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
confuzedagain
 
Posts: n/a
Default CSV file Imported to Excel


Another option is to open a blank excel sheet. Go to Data Import
External Data, Import Data. Then choose the file. Once it opens the
file in the wizard, you can use the formating option per cell to format
the cells before importing. This was Excel does not mess with the
data/change the data.

I also run into this issue where Excel likes to change certain things
to dates, Scientific, or whatever and screw up the info, so formatting
as text solves this problem as Excel will import it as text and not
mess with the original formatting.

Just a thought.


--
confuzedagain
------------------------------------------------------------------------
confuzedagain's Profile: http://www.excelforum.com/member.php...o&userid=29439
View this thread: http://www.excelforum.com/showthread...hreadid=491323

  #4   Report Post  
Posted to microsoft.public.excel.misc
jlucy
 
Posts: n/a
Default CSV file Imported to Excel

In addition to what Dave Peterson suggested, if you enter 13 spaces in the
"Find What" box in the Find and Replace window then it won't replace all the
single "good" spaces, if you have them, just the string of 13. You can also
check Match entire cell contents under Options in the Find and Replace
window. This won't get any cells with only 12 spaces though.

Also, Excel will still potentially not see that cell that you replaced
spaces with blanks as an actual blank cell. (I wish I knew why.) Not a big
deal unless you use formulas with ISBLANK() or COUNTA(), etc.



"Dave Peterson" wrote:

I think I'd try to fix the problem before it got to excel. Maybe you could go
back to the sender and ask them to change the way they create the file.

If that's not possible, then (maybe) just open the file and do edit|replace.
Replace a space character with (leave blank).

If you have actual words in any of the fields that are separated by spaces, this
is not a good idea.

But maybe you could just select the range to change first, then do the mass
change.

If worse came to worse, you could always cycle through the usedrange.

dim myCell as range
for each mycell in activesheet.usedrange
if trim(mycell.value) = "" then
mycell.clearcontents
end if
next mycell

===
Or just run David McRitchie's TrimAll (that may fix other problems as well):
http://www.mvps.org/dmcritchie/excel/join.htm#trimall
(look for "Sub Trimall()")

JMay wrote:

I rec'd a CSV file today @ work. From Excel I did a File, Open and it opened
immediately (without the File Open Wizard which I was hoping for). Anyway,
everything LOOKED fine in the Range of numbers between B2 and K30 - with 20 or
30 blank cell among the numbers; I later
found out the blank cells WERE NOT Blank, but rather had 13 hard-coded space
characters in them.

I later opend the file in Word Pad and saw how that it appeared something like
as follows:

4344.56, 3232.56, , 555.55,

Where in excel it was:
B C D E
2 4,344.56 3,232.56 "13spaces" 555.55

This situation SHOULD be corrected before it gets to the end user, but what
should be done to eliminate the fields creating the 13 spaces versus a null
string ""?
Thanks in advance,,
Jim


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Saved *.csv file gives SYLK file type warning upon Excel 2003 open Tom Excel Discussion (Misc queries) 5 March 19th 08 03:15 PM
TRYING TO SET UP EXCEL SPREADSHEET ON MY COMPUTER MEGTOM New Users to Excel 5 October 27th 05 03:06 AM
CSV file containing german characters imported into Excel Peter @ fjs Excel Discussion (Misc queries) 0 October 26th 05 05:32 PM
Refresh Imported Data - Does the Excel file have to be open? tinkertoy Excel Discussion (Misc queries) 0 June 23rd 05 07:51 PM
Read Text File into Excel Using VBA Willie T Excel Discussion (Misc queries) 13 January 8th 05 12:37 AM


All times are GMT +1. The time now is 12:53 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"