How to extract word upto specified word by single formula?

London12F

Board Regular
Joined
Jun 21, 2016
Messages
59
[TABLE="width: 502"]
<colgroup><col></colgroup><tbody>[TR]
[TD]How to extract words upto specified word ("Co ", "Eng", "Construction", "(") by single formula (not by VBA)(not by array formula)?[/TD]
[/TR]
[TR]
[TD] [/TD]
[/TR]
[TR]
[TD]i.e.[/TD]
[/TR]
[TR]
[TD] [/TD]
[/TR]
[TR]
[TD]ABC DE Co Ltd[/TD]
[/TR]
[TR]
[TD]FGH IJ KL Eng Co Ltd[/TD]
[/TR]
[TR]
[TD]ABC Construction Ltd[/TD]
[/TR]
[TR]
[TD]ABC (China) Co Ltd[/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD]to[/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD]ABC DE[/TD]
[/TR]
[TR]
[TD]FGH IJ KL[/TD]
[/TR]
[TR]
[TD]ABC[/TD]
[/TR]
[TR]
[TD]ABC[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
How to extract words upto specified word ("Co ", "Eng", "Construction", "(") by single formula (not by VBA)(not by array formula)?
That is a lot of restrictions for a text string manipulations problem. Is there a maximum length to the text that can be in a cell?
 
Upvote 0
There is no maximum length to the text, but it should be upto 3 words.
Then I am pretty sure there is no way to do this with a normally entered formula... and I am reasonably sure that any array-entered formula is going to be "ugly" at best. While you don't want a VBA solution, I am going to post one for future readers of this thread (you will have to wait for someone better versed in formulas than I am to try and give you what you have asked for). The following function can be called from other VBA code or used as a UDF (user defined function) within an Excel formula...
Code:
Function UpperCaseWords(S As String) As String
  Dim X As Long
  For X = 1 To Len(S)
    If Mid(S, X, 1) Like "[a-z]" Then
      UpperCaseWords = Left(S, InStrRev(Left(S, X), " ") - 1)
      Exit Function
    End If
  Next
End Function
The above function pulls out upper case words up to, but not including, the first word with a lower case letter in it.
 
Last edited:
Upvote 0
Does this satisfy?

In B2 enter and copy down:

=TRIM(LEFT(A2,LOOKUP(9.99999999999999E+307,SEARCH(" "&{"co*","(*","eng"}&" "," "&A2&" "))-1))
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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