Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default When importing text field Excel chops off leading spaces

I need to import text files into Excel. These files have a field that
contains a long series of letters, representing student responses to
test questions. When I import these as Fixed Width data, putting in
the break points manually, Excel chops all leading spaces off of those
long series of letters. In other words, " BCD DA" becomes "BCD DA".

Obviously, this makes it appear that the student answered the first
two questions "BC" when really she failed to answer those first two
questions.

This happens regardless of whether I designate that column as a
General or Text field.

When I import the text file into Access, I don't have this problem. Is
there any way to fix it in Excel?

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,045
Default When importing text field Excel chops off leading spaces

On Sat, 23 Jul 2011 15:41:13 -0700 (PDT), septimus wrote:

I need to import text files into Excel. These files have a field that
contains a long series of letters, representing student responses to
test questions. When I import these as Fixed Width data, putting in
the break points manually, Excel chops all leading spaces off of those
long series of letters. In other words, " BCD DA" becomes "BCD DA".

Obviously, this makes it appear that the student answered the first
two questions "BC" when really she failed to answer those first two
questions.

This happens regardless of whether I designate that column as a
General or Text field.

When I import the text file into Access, I don't have this problem. Is
there any way to fix it in Excel?

Thanks.


It is annoying behavior, for sure.

One way: before running the wizard, use Find/Replace to replace all the <space's with some other character that does not occur normally in your data (e.g. tilde, ampersand, CHAR(1),etc). Then run the wizard with the columns designated to be TEXT. Then use Find/Replace again to change those characters back to <space's.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default When importing text field Excel chops off leading spaces

Hm. That does seem to work. Maybe not the most elegant solution in the
world, but it does appear to get the job done. Thanks!

On Jul 23, 8:11*pm, Ron Rosenfeld wrote:
On Sat, 23 Jul 2011 15:41:13 -0700 (PDT), septimus wrote:
I need to import text files into Excel. These files have a field that
contains a long series of letters, representing student responses to
test questions. When I import these as Fixed Width data, putting in
the break points manually, Excel chops all leading spaces off of those
long series of letters. In other words, " *BCD DA" becomes "BCD DA".


Obviously, this makes it appear that the student answered the first
two questions "BC" when really she failed to answer those first two
questions.


This happens regardless of whether I designate that column as a
General or Text field.


When I import the text file into Access, I don't have this problem. Is
there any way to fix it in Excel?


Thanks.


It is annoying behavior, for sure.

One way: before running the wizard, use Find/Replace to replace all the <space's with some other character that does not occur normally in your data (e.g. tilde, ampersand, CHAR(1),etc). *Then run the wizard with the columns designated to be TEXT. * Then use Find/Replace again to change those characters back to <space's.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,045
Default When importing text field Excel chops off leading spaces

On Sun, 24 Jul 2011 13:52:32 -0700 (PDT), septimus wrote:

Hm. That does seem to work. Maybe not the most elegant solution in the
world, but it does appear to get the job done. Thanks!


Glad to help. Since the method seems to work, you could probably simplify things using a macro.

By the way, when I import the data "delimited", the leading spaces seem to be preserved. But you probably know that.
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
IMPORTING PC-DOS PLAIN TEXT FILES WITH LEADING SPACES Robert1998 Excel Discussion (Misc queries) 4 October 22nd 08 06:16 AM
Importing Text File into Excel loses leading zero on some fields. [email protected] Excel Programming 4 December 18th 07 08:29 PM
Getting Notepad.exe text in Excel including leading spaces Sally[_5_] Excel Programming 1 November 3rd 05 10:12 PM
Excel "chops off" half of first line of text bobf Excel Discussion (Misc queries) 2 April 6th 05 01:11 PM
Saving XL ranges as Fixed Field Length Text - Leading spaces AS Excel Programming 2 March 17th 05 08:33 PM


All times are GMT +1. The time now is 01:42 AM.

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

About Us

"It's about Microsoft Excel"