Custom Split

Bullflip

New Member
Joined
Jun 2, 2020
Messages
19
Office Version
  1. 365
Platform
  1. Windows
Hi,

I am trying to figure out a way to split off the state abbreviation into a separate column. Currently, it's mixed with the street address in one column. Please see below:

Capture.JPG


I want to separate the state abbreviations in the state column so I'm looking to split off the first letters from the right (or last 2 letters from the left depending on how you view it). For example, the first row that has "22 E. Claiborne StreetAL36461", it should be able to split off "AL".

Any help would be greatly appreciated. Thanks!
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Assuming that your first entry is in cell B2, put this formula in C2 and copy down:
=IF(ISNUMBER(MID(B2,LEN(B2)-5,1)+0),MID(B2,LEN(B2)-10,2),MID(B2,LEN(B2)-6,2))
 
Upvote 0
Assuming that your first entry is in cell B2, put this formula in C2 and copy down:
=IF(ISNUMBER(MID(B2,LEN(B2)-5,1)+0),MID(B2,LEN(B2)-10,2),MID(B2,LEN(B2)-6,2))

This worked perfectly. If you have some time, could you please walk me through the formula? Would like to have a complete understanding of what it is doing logically. Thank you again!
 
Upvote 0
Take it apart bit-by-bit, and you'll be able to see what it does.

So, first try this part:
=MID(B2,LEN(B2)-5,1)

And then this:
=MID(B2,LEN(B2)-10,2)

and this:
=MID(B2,LEN(B2)-6,2)

Once you see what those three parts are doing, it should make more sense.

If there is some part still puzzling you after that, please post back and let me know.
 
Upvote 0

Forum statistics

Threads
1,214,644
Messages
6,120,709
Members
448,983
Latest member
Joaquim_Baptista

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