Split String at occurrence of Uppercase

Blessy Clara

Board Regular
Joined
Mar 28, 2010
Messages
201
Hi

I have a column of address - with the City in Upper case, I would like to split the string at the occurrence of Uppercase from right

Example - Uppercase i have highlighted as Red here

Unit 12, Wellington Fair 40 Lord Street (Entrance off Wellington Street) EAST PERTH
Building 3, Level B, Suites B53-B56 1 Kirinari Street BRUCE
Level 3 106 Edward Street BRISBANE
Post Split
Unit 12, Wellington Fair 40 Lord Street (Entrance off Wellington Street) EAST PERTH
Building 3, Level B, Suites B53-B56 1 Kirinari Street BRUCE

<tbody>
</tbody>

Thank you
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Hello,

try this code

Code:
for i = 1 to cells(rows.count,1) 'all cells in column A
    for k = 1 to len(cells(i,1) -2 'loop all characters
        if mid(cells(i,1),k,2) like "[A-ZA-Z]" then cells(i,2) = left(cells(i,1),k)
    next k
next i

(untested)

regards
 
Last edited:
Upvote 0
Hi Fennek,

Thank you for the code - Please i need some guidance to go about , I am getting compile error - Invalid outside procedure?
 
Upvote 0
do you need this?

Code:
'NO option explicit
sub iFen()
for i = 1 to cells(rows.count,1) 'all cells in column A
    for k = 1 to len(cells(i,1) -2 'loop all characters
        if mid(cells(i,1),k,2) like "[A-ZA-Z]" then cells(i,2) = left(cells(i,1),k)
    next k
next i
end sub
 
Upvote 0
Hi Fennek,

Thank you for the suggestion, i tried , not getting an error this time but nothing happening, the cols are not split.
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,194
Members
449,072
Latest member
DW Draft

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