Inserting space 3 characters from right

jennybenny

New Member
Joined
Feb 17, 2015
Messages
8
Hi,

I have what I think is quite a simple issue, but it's baffled me! I have a list of postcodes and I need to add a space in the middle in order to use it with another data source which are already formatted this way.

I currently have postcodes such as 'PR88AG' and I need to add a space before the last 3 characters. From what I've already attempted/ found, the formula sometimes doesn't work as the left half of the postcode can vary from 2-4 characters- i.e. P8 4AG/ PR10/ PR8. From my knowledge the second half of UK postcodes always have 3 characters, so I need to add the space from the right, not from the left if that's possible please.

Thanks in advance.
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
how about

=LEFT(A1,(LEN(A1)-3))&" "&RIGHT(A1,3)


this will isolate the last 3 no matter how many digits are in your postal code
 
Last edited:
Upvote 0
Thanks, this works great.

Originally it didn't seem to be working on the raw data set I have, but was working if I typed the postcode in manually- it finally dawned on me that there is a space at the end of each cells in the data I have been sent (which is why I couldn't get it to work originally when I tried to write it). So I have used substitute to remove the end space and then the formula by danzon to get the space 3 from right.

Thanks so much for your help!
 
Upvote 0

Forum statistics

Threads
1,223,237
Messages
6,170,928
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top