How to Copy Text to Fixed Length with leading Spaces ?

  • Thread starter Thread starter tmb
  • Start date Start date
T

tmb

I need to copy the text data in one cell to another cell and end up with
Fixed Length Ascii.

Example:

A1 = XYZ
B1 = --XYZ

Where -- are actually either Spaces

thanks for any help
 
=IF(LEN(A1)<5,REPT(" ",5-LEN(A1)),"")&A1

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
It appears, from another post of yours, that you're going to use this to
create a fixed-length file. If your data is text, you'll want padding on
the right, most likely, but if numeric, you'll want left.

There's a non-macro way to do all of this. Look at
http://www.smokeylake.com/excel/textfiles.htm. And there are other posts on
this subject in these newsgroups you should look at.
 
Back
Top