ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Insert a fixed number of characters (https://www.excelbanter.com/excel-programming/389182-insert-fixed-number-characters.html)

clara

Insert a fixed number of characters
 
Hi all,

Is there a function which can insert a fixed number of character. I want to
use this kind of function to do the alignment.

Clara
--
thank you so much for your help

cory

Insert a fixed number of characters
 
Clara - sounds like the repeat function would work for you. For example,

=REPT("A",7)

would return seven A's ("AAAAAAA"). Alternatively, you might also find the
Text function useful for aligning numbers:

=TEXT(1,"0000")

would return "0001".

Hope this helps.

-Cory

"clara" wrote:

Hi all,

Is there a function which can insert a fixed number of character. I want to
use this kind of function to do the alignment.

Clara
--
thank you so much for your help


Tim Williams

Insert a fixed number of characters
 
'Left-pad a string v with spaces, to a total length of i characters
Function lPad(v, i) As String
lPad = String(i - Len(v), " ") & v
End Function

Tim


"clara" wrote in message
...
Hi all,

Is there a function which can insert a fixed number of character. I want
to
use this kind of function to do the alignment.

Clara
--
thank you so much for your help




Dave Peterson

Insert a fixed number of characters
 
I'm not sure what you're doing, but if you're trying to indent a value in a
cell, you may want to

select the range
format|cells|alignment tab
and increase the indent box

The underlying value doesn't change.


clara wrote:

Hi all,

Is there a function which can insert a fixed number of character. I want to
use this kind of function to do the alignment.

Clara
--
thank you so much for your help


--

Dave Peterson


All times are GMT +1. The time now is 05:46 PM.

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