Array formula to extract a word from a string issue

Folander

New Member
Joined
Feb 16, 2016
Messages
18
Hi all,

I am trying to extract a surname from a text string, something like thisSmithTaxi. The array formula I am using (and shamelessly nicked off this forum)is below, I think the formula is extracting the characters up until there is anew capital letter in the string.

=TRIM(LEFT(G16,SMALL(FIND(CHAR(ROW(INDIRECT("65:90"))),G16&"ABCDEFGHIJKLMNOPQRSTUVWXYZ"),2)-1))

It works brilliantly except when the surname is the same as the next word withthe capital letter, like ThompsonTaxi. It returns the whole word, ThompsonTaxi,rather than just Thompson, like SmithTaxi would return Smith.

Does anyone know of how I can work around this?

Cheers,

Fo.


 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Maybe:

=TRIM(LEFT(G16,SMALL(FIND(CHAR(ROW(INDIRECT("65:90"))),"x"&MID(G16,2,999)&"ABCDEFGHIJKLMNOPQRSTUVWXYZ"),1)-1))

with Control+Shift+Enter. This ignores the first character in the string, and looks for the first upper case letter after that.
 
Upvote 0
Maybe:

=TRIM(LEFT(G16,SMALL(FIND(CHAR(ROW(INDIRECT("65:90"))),"x"&MID(G16,2,999)&"ABCDEFGHIJKLMNOPQRSTUVWXYZ"),1)-1))

with Control+Shift+Enter. This ignores the first character in the string, and looks for the first upper case letter after that.

That has worked perfectly, thanks very much!
 
Upvote 0
Would this non Ctrl+Shift+Enter formula also work for you?

=LEFT(G16,AGGREGATE(15,6,FIND(CHAR(ROW(INDIRECT("65:90"))),G16,2),1)-1)
 
Upvote 0

Forum statistics

Threads
1,223,889
Messages
6,175,224
Members
452,620
Latest member
dsubash

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