View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.misc
FSt1 FSt1 is offline
external usenet poster
 
Posts: 3,942
Default Fixed length string of text

hi
i did this a tad different.
assuming data in A1 and B1 would be standart length.....
in E1, put this to establish a template.
=A1&B1&C1&" "&D1 with 6 spaces to start. change if needed.
using E1 as a template in E2, enter....
=A2&B2&C2&REPT(" ",LEN(E$1)-LEN(A2&B2&C2&D2))&D2
all cells below E1 ended up with the same number of characters. i tested 10.
and using Biff's suggestion put a nice square edge to it all.

downside. longest name must be in E1 else error will occur further down the
list.
not sure if that is a problem.

regards
FSt1

"MWysack" wrote:

Hello,
I am trying to create strings of text by combining cells using CONCATENATE.
I need to have each string of text to be the same length. Below are some
examples of the text strings:

A1= 0000001
B1=123456789
C1= Doe
D1= John

A2=0000002
B2=987654321
C2=Smith
D2=John

In need the lines to look like this:
0000001123456789Doe John
0000002987654321Smith John

This is what they look like when I use CONCATENATE:
0000001123456789DoeJohn
0000002987654321SmithJohn

Is there anyway to get these strings of text to look like this without
manually adding the spaces for each line?

Thanks,
Megan