ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Address must be 18 characters long (https://www.excelbanter.com/excel-worksheet-functions/264753-address-must-18-characters-long.html)

Derek M[_2_]

Address must be 18 characters long
 
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

Brad

Address must be 18 characters long
 
=left(a1&rept(" ",18),18)

This will add spaced at the end

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

--
Wag more, bark less


"Derek M" wrote:

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


Steve Dunn

Address must be 18 characters long
 
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)



"Brad" wrote in message
...
=left(a1&rept(" ",18),18)

This will add spaced at the end

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

--
Wag more, bark less


"Derek M" wrote:

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



Derek M[_2_]

Address must be 18 characters long
 
Fantastic, thanks guys

"Steve Dunn" wrote:

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)



"Brad" wrote in message
...
=left(a1&rept(" ",18),18)

This will add spaced at the end

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

--
Wag more, bark less


"Derek M" wrote:

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




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

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