Force spaces in a cell (Excel 2003)

  • Thread starter Thread starter Luigi
  • Start date Start date
L

Luigi

Hi all,
I need to force a specified number of spaces in a cell so, when the file is
saved in .CSV format, results a delimited and spaced file.
For example, something like this:

testCellA1 ;testCellB1 ;
etc

How can I obtain this?

Thanks in advance.
 
You can do it with the REPT function - suppose you want the field to
be 20 characters wide:

=A1&REPT(20-LEN(A1)," ")

Hope this helps.

Pete
 
Pete_UK said:
You can do it with the REPT function - suppose you want the field to
be 20 characters wide:

=A1&REPT(20-LEN(A1)," ")

Hope this helps.

Hi Pete, thanks a lot, it's work.
Is there a way to force a semicolon (;) on the end of the row when the file
is saved in .CSV format?

Luigi
 
I don't know, as I don't save to CSV very often. However, you can always do
this:

=A1&REPT(20-LEN(A1)," ")&";"

for each field (or just for the final field if you only want the ; once per
row), and then save the file as a .txt file. You can then rename the file to
..csv in Explorer if you need to.

Hope this helps.

Pete
 
Pete_UK said:
I don't know, as I don't save to CSV very often. However, you can always do
this:

=A1&REPT(20-LEN(A1)," ")&";"

for each field (or just for the final field if you only want the ; once per
row), and then save the file as a .txt file. You can then rename the file to
..csv in Explorer if you need to.

Hope this helps.

Pete
It's seem it works well.
Thanks Pete.

Luigi
 
Back
Top