#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Format of Postcodes

I have a formula, but it does not quite meet with my needs.

=REPLACE(A1,LEN(A1)-2,0,REPT(" ",8-LEN(A1)))

gives the result:

Eg:
AB19PQ
PE548YT

Changes it to:
AB1 9PQ
PE54 8YT

The 7-digit postcode is spaced correctly, but I would like an extra
space to appear in the 6-digit postcode i.e. AB 1 9PQ

Any ideas?

Thanks.

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Format of Postcodes

My solution for the 6 digit codes slightly different than your for the 7
digit ones but try this:-

=IF(LEN(A1)=7,REPLACE(A1,LEN(A1)-2,0,REPT(" ",8-LEN(A1))),LEFT(A1,2)&"
"&MID(A1,3,1)&" "&MID(A1,4,3))

Mike

"pseudonym" wrote:

I have a formula, but it does not quite meet with my needs.

=REPLACE(A1,LEN(A1)-2,0,REPT(" ",8-LEN(A1)))

gives the result:

Eg:
AB19PQ
PE548YT

Changes it to:
AB1 9PQ
PE54 8YT

The 7-digit postcode is spaced correctly, but I would like an extra
space to appear in the 6-digit postcode i.e. AB 1 9PQ

Any ideas?

Thanks.


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Format of Postcodes

Why does this put a square symbol in the newly-created space?




On 18 May, 12:21, Mike H wrote:
My solution for the 6 digit codes slightly different than your for the 7
digit ones but try this:-

=IF(LEN(A1)=7,REPLACE(A1,LEN(A1)-2,0,REPT(" ",8-LEN(A1))),LEFT(A1,2)&"
"&MID(A1,3,1)&" "&MID(A1,4,3))

Mike

"pseudonym" wrote:
I have a formula, but it does not quite meet with my needs.


=REPLACE(A1,LEN(A1)-2,0,REPT(" ",8-LEN(A1)))


gives the result:


Eg:
AB19PQ
PE548YT


Changes it to:
AB1 9PQ
PE54 8YT


The 7-digit postcode is spaced correctly, but I would like an extra
space to appear in the 6-digit postcode i.e. AB 1 9PQ


Any ideas?


Thanks.



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Format of Postcodes

It doesn't do it on my machine and If it does on yours then I'm confused!!
All it does is concatenate the 6 digit postcode with spaces. Any chance of a
paste of what it looks like.

Mike

"pseudonym" wrote:

Why does this put a square symbol in the newly-created space?




On 18 May, 12:21, Mike H wrote:
My solution for the 6 digit codes slightly different than your for the 7
digit ones but try this:-

=IF(LEN(A1)=7,REPLACE(A1,LEN(A1)-2,0,REPT(" ",8-LEN(A1))),LEFT(A1,2)&"
"&MID(A1,3,1)&" "&MID(A1,4,3))

Mike

"pseudonym" wrote:
I have a formula, but it does not quite meet with my needs.


=REPLACE(A1,LEN(A1)-2,0,REPT(" ",8-LEN(A1)))


gives the result:


Eg:
AB19PQ
PE548YT


Changes it to:
AB1 9PQ
PE54 8YT


The 7-digit postcode is spaced correctly, but I would like an extra
space to appear in the 6-digit postcode i.e. AB 1 9PQ


Any ideas?


Thanks.




  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,856
Default Format of Postcodes

You are probably suffering from line-wrap if you pasted the formula
from the posting. The middle part of the formula should be:

.... LEFT(A1,2)&" "&MID(A1,3,1) ...

but you probably have a different character between the quotes.

Hope this helps.

Pete

On May 18, 12:27 pm, pseudonym wrote:
Why does this put a square symbol in the newly-created space?

On 18 May, 12:21, Mike H wrote:



My solution for the 6 digit codes slightly different than your for the 7
digit ones but try this:-


=IF(LEN(A1)=7,REPLACE(A1,LEN(A1)-2,0,REPT(" ",8-LEN(A1))),LEFT(A1,2)&"
"&MID(A1,3,1)&" "&MID(A1,4,3))


Mike


"pseudonym" wrote:
I have a formula, but it does not quite meet with my needs.


=REPLACE(A1,LEN(A1)-2,0,REPT(" ",8-LEN(A1)))


gives the result:


Eg:
AB19PQ
PE548YT


Changes it to:
AB1 9PQ
PE54 8YT


The 7-digit postcode is spaced correctly, but I would like an extra
space to appear in the 6-digit postcode i.e. AB 1 9PQ


Any ideas?


Thanks.- Hide quoted text -


- Show quoted text -





  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Format of Postcodes

An unfortunate line wrap:

=IF(LEN(A1)=7,REPLACE(A1,LEN(A1)-2,0,REPT(" ",8-LEN(A1))),
LEFT(A1,2)&" "&MID(A1,3,1)&" "&MID(A1,4,3))

(still one cell)

pseudonym wrote:

Why does this put a square symbol in the newly-created space?

On 18 May, 12:21, Mike H wrote:
My solution for the 6 digit codes slightly different than your for the 7
digit ones but try this:-

=IF(LEN(A1)=7,REPLACE(A1,LEN(A1)-2,0,REPT(" ",8-LEN(A1))),LEFT(A1,2)&"
"&MID(A1,3,1)&" "&MID(A1,4,3))

Mike

"pseudonym" wrote:
I have a formula, but it does not quite meet with my needs.


=REPLACE(A1,LEN(A1)-2,0,REPT(" ",8-LEN(A1)))


gives the result:


Eg:
AB19PQ
PE548YT


Changes it to:
AB1 9PQ
PE54 8YT


The 7-digit postcode is spaced correctly, but I would like an extra
space to appear in the 6-digit postcode i.e. AB 1 9PQ


Any ideas?


Thanks.


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,886
Default Format of Postcodes

Hi

It has been created by the wrapping of the formula in the NG reader.
This wrapping happens to take place in the middle of the space between
the double quotes.

After pasting the formula into the formula bar of your sheet, it will be
on 2 lines.
Place the cursor at the end of the first line and press Delete once.
That will bring the formula onto one line and the symbol will disappear.

Below I have reproduce Mike's formula, but forced the break to be after
the comma.

=IF(LEN(A1)=7,REPLACE(A1,LEN(A1)-2,0,REPT(" ",8-LEN(A1))),
LEFT(A1,2)&" "&MID(A1,3,1)&" "&MID(A1,4,3))

If that were copied and pasted, even though it is on multiple lines, you
will not get the square symbol

--
Regards

Roger Govier


"pseudonym" wrote in message
ups.com...
Why does this put a square symbol in the newly-created space?




On 18 May, 12:21, Mike H wrote:
My solution for the 6 digit codes slightly different than your for
the 7
digit ones but try this:-

=IF(LEN(A1)=7,REPLACE(A1,LEN(A1)-2,0,REPT("
",8-LEN(A1))),LEFT(A1,2)&"
"&MID(A1,3,1)&" "&MID(A1,4,3))

Mike

"pseudonym" wrote:
I have a formula, but it does not quite meet with my needs.


=REPLACE(A1,LEN(A1)-2,0,REPT(" ",8-LEN(A1)))


gives the result:


Eg:
AB19PQ
PE548YT


Changes it to:
AB1 9PQ
PE54 8YT


The 7-digit postcode is spaced correctly, but I would like an extra
space to appear in the 6-digit postcode i.e. AB 1 9PQ


Any ideas?


Thanks.





  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Format of Postcodes

Thanks people I thought I was having (another) elderly moment!!

"Mike H" wrote:

It doesn't do it on my machine and If it does on yours then I'm confused!!
All it does is concatenate the 6 digit postcode with spaces. Any chance of a
paste of what it looks like.

Mike

"pseudonym" wrote:

Why does this put a square symbol in the newly-created space?




On 18 May, 12:21, Mike H wrote:
My solution for the 6 digit codes slightly different than your for the 7
digit ones but try this:-

=IF(LEN(A1)=7,REPLACE(A1,LEN(A1)-2,0,REPT(" ",8-LEN(A1))),LEFT(A1,2)&"
"&MID(A1,3,1)&" "&MID(A1,4,3))

Mike

"pseudonym" wrote:
I have a formula, but it does not quite meet with my needs.

=REPLACE(A1,LEN(A1)-2,0,REPT(" ",8-LEN(A1)))

gives the result:

Eg:
AB19PQ
PE548YT

Changes it to:
AB1 9PQ
PE54 8YT

The 7-digit postcode is spaced correctly, but I would like an extra
space to appear in the 6-digit postcode i.e. AB 1 9PQ

Any ideas?

Thanks.




  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Format of Postcodes

Thanks everyone


On 18 May, 13:29, Mike H wrote:
Thanks people I thought I was having (another) elderly moment!!

"Mike H" wrote:
It doesn't do it on my machine and If it does on yours then I'm confused!!
All it does is concatenate the 6 digit postcode with spaces. Any chance of a
paste of what it looks like.


Mike


"pseudonym" wrote:


Why does this put a square symbol in the newly-created space?


On 18 May, 12:21, Mike H wrote:
My solution for the 6 digit codes slightly different than your for the 7
digit ones but try this:-


=IF(LEN(A1)=7,REPLACE(A1,LEN(A1)-2,0,REPT(" ",8-LEN(A1))),LEFT(A1,2)&"
"&MID(A1,3,1)&" "&MID(A1,4,3))


Mike


"pseudonym" wrote:
I have a formula, but it does not quite meet with my needs.


=REPLACE(A1,LEN(A1)-2,0,REPT(" ",8-LEN(A1)))


gives the result:


Eg:
AB19PQ
PE548YT


Changes it to:
AB1 9PQ
PE54 8YT


The 7-digit postcode is spaced correctly, but I would like an extra
space to appear in the 6-digit postcode i.e. AB 1 9PQ


Any ideas?


Thanks.



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
Format of postcodes pseudonym Excel Discussion (Misc queries) 3 May 18th 07 11:40 AM
Postcodes starting with 0 fordrules01 Excel Discussion (Misc queries) 4 November 29th 06 08:32 AM
Standardising Postcodes dewheatley Excel Discussion (Misc queries) 19 November 8th 06 11:11 PM
Sorting UK Postcodes Aristobulus Excel Worksheet Functions 4 September 16th 06 04:51 PM
Postcodes PH NEWS Excel Worksheet Functions 6 May 5th 06 10:11 AM


All times are GMT +1. The time now is 11:54 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"