Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 183
Default What excel snyntax and or function will add leading spaces

I have a requirement to have meet a specified field length. For example if
name field length is 7 and the name entered is SAM; what functions
(operations, marcos, vb scripts) are available in excel that can
automatically add either leading or trailing spaces to make the length equal
to 7?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,718
Default What excel snyntax and or function will add leading spaces

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

"Sharon" wrote:

I have a requirement to have meet a specified field length. For example if
name field length is 7 and the name entered is SAM; what functions
(operations, marcos, vb scripts) are available in excel that can
automatically add either leading or trailing spaces to make the length equal
to 7?

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 563
Default What excel snyntax and or function will add leading spaces

=LEFT(" ",7-LEN(A1))&A1
there are 7 spaces between opening and closing "
or
=A1&LEFT(" ",7-LEN(A1))

But you now have SAM in cole column and SAM____ in another
You could use copy followed by Paste Special with Values specified to make
the first column unneeded but this would be after all data was entered.

If you want the change to happen on the fly, please post Q to the
Programming group

best wishes

--
www.stfx.ca/people/bliengme


"Sharon" wrote:

I have a requirement to have meet a specified field length. For example if
name field length is 7 and the name entered is SAM; what functions
(operations, marcos, vb scripts) are available in excel that can
automatically add either leading or trailing spaces to make the length equal
to 7?

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default What excel snyntax and or function will add leading spaces

A couple mo

=right(rept(" ",7)&a1,7)

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



Sharon wrote:

I have a requirement to have meet a specified field length. For example if
name field length is 7 and the name entered is SAM; what functions
(operations, marcos, vb scripts) are available in excel that can
automatically add either leading or trailing spaces to make the length equal
to 7?


--

Dave Peterson
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
remove leading spaces harwookf Excel Worksheet Functions 7 January 25th 08 01:56 PM
how do I remove leading spaces and leave the remianing spaces w Debi Excel Worksheet Functions 6 February 28th 07 03:29 PM
How keep Leading/Trailing spaces when save in Excel? jorgejulio Excel Discussion (Misc queries) 0 August 1st 06 09:49 PM
How do I add leading spaces to a value? Chris Brown Excel Worksheet Functions 3 March 3rd 06 05:23 PM
Remove Leading Spaces Kirk P. Excel Discussion (Misc queries) 3 March 3rd 05 01:30 PM


All times are GMT +1. The time now is 07:08 PM.

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

About Us

"It's about Microsoft Excel"