Address must be 18 characters long

D

Derek M

Hi all again

I need the address to be 18 characters long i.e. if the address is over 18
characters then chop it, if its under, then add spaces

Is this possible?

Thanks as always

Derek
 
B

Brad

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

This will add spaced at the end

if you want spaces in front
=right(rept(" ",18)&a1,18)
 
S

Steve Dunn

that second formula would result in the last 18 characters of the address if
A1 was already longer than that.

=left(rept(" ",max(0,18-len(a1)))&a1,18)
 
D

Derek M

Fantastic, thanks guys

Steve Dunn said:
that second formula would result in the last 18 characters of the address if
A1 was already longer than that.

=left(rept(" ",max(0,18-len(a1)))&a1,18)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top