ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Text with repeating trailing spaces (https://www.excelbanter.com/excel-worksheet-functions/223646-text-repeating-trailing-spaces.html)

briancrosier

Text with repeating trailing spaces
 
I need to create a text string from several different values that I have
calculated, however I need the resulting string to be fixed width (ie. the
first entry needs to be inserted followed by spaces to total 30 characters).
I know it can be done as I did this previously, but forget how. Can anybody
help?

Gary''s Student

Text with repeating trailing spaces
 
=A1 & REPT(" ",30-LEN(A1))

--
Gary''s Student - gsnu200837

Gord Dibben

Text with repeating trailing spaces
 
=F5&REPT(" ",30-(LEN(F5)))

You haven't said what to do with remaining "several values" in the string
but just keep '&'ing


Gord Dibben MS Excel MVP

On Mon, 9 Mar 2009 11:28:01 -0700, briancrosier
wrote:

I need to create a text string from several different values that I have
calculated, however I need the resulting string to be fixed width (ie. the
first entry needs to be inserted followed by spaces to total 30 characters).
I know it can be done as I did this previously, but forget how. Can anybody
help?



Dave Peterson

Text with repeating trailing spaces
 
=left(a1&rept(" ",30),30)

Will truncate/pad the string in A1 at 30 characters.

briancrosier wrote:

I need to create a text string from several different values that I have
calculated, however I need the resulting string to be fixed width (ie. the
first entry needs to be inserted followed by spaces to total 30 characters).
I know it can be done as I did this previously, but forget how. Can anybody
help?


--

Dave Peterson

briancrosier

Text with repeating trailing spaces
 
Thnaks every body, it was the REPT function that I had forgotten.

"Dave Peterson" wrote:

=left(a1&rept(" ",30),30)

Will truncate/pad the string in A1 at 30 characters.

briancrosier wrote:

I need to create a text string from several different values that I have
calculated, however I need the resulting string to be fixed width (ie. the
first entry needs to be inserted followed by spaces to total 30 characters).
I know it can be done as I did this previously, but forget how. Can anybody
help?


--

Dave Peterson



All times are GMT +1. The time now is 04:46 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com