Formula to extract upper case words in a text string

spbcson

New Member
Joined
Feb 11, 2013
Messages
15
IS THERE A FORMULA TO EXTRACT A UPPER CASE FROM A TEXT STRING IN A CELL? Example in cell A1 i have this text string:
//-- y MICROSOFT EXCEL computer software June 23489​

How can I get only the words "MICROSOFT EXCEL"
 
Sorry This is it:

Cell A: f r^ ISALIA ZARRASON' DE GOICOCHEA [ 1 ^'zr'x''—Los Cerritos 1 V CEBORCA 25227
Cell B (with function): ISALIA ZARRASON
 
Upvote 0

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Sorry This is it:

Cell A: f r^ ISALIA ZARRASON' DE GOICOCHEA [ 1 ^'zr'x''—Los Cerritos 1 V CEBORCA 25227
Cell B (with function): ISALIA ZARRASON
Have you read either one of my last two messages???
 
Upvote 0
Have you read either one of my last two messages???

How can I get from the string:

f r^ ISALIA ZARRASON' DE GOICOCHEA [ 1 ^'zr'x''—Los Cerritos 1 V CEBORCA 25227

Los Cerritos?

That part of text always come with the first letter in upper case

Regards
 
Upvote 0
How can I get from the string:

f r^ ISALIA ZARRASON' DE GOICOCHEA [ 1 ^'zr'x''—Los Cerritos 1 V CEBORCA 25227

Los Cerritos?

That part of text always come with the first letter in upper case
Give this UDF a try...
Code:
Function ProperCaseWords(S As String) As String
  Dim X As Long, TempText As String, Words() As String
  TempText = S
  For X = 1 To Len(TempText)
    If Mid(TempText, X, 1) Like "[!A-Za-z ]" Then Mid(TempText, X) = " "
  Next
  Words = Split(Application.Trim(TempText))
  For X = 0 To UBound(Words)
    If Words(X) <> StrConv(Words(X), vbProperCase) Or Len(Words(X)) = 1 Then Words(X) = ""
  Next
  ProperCaseWords = Application.Trim(Join(Words))
End Function
 
Upvote 0
Give this UDF a try...
Code:
Function ProperCaseWords(S As String) As String
  Dim X As Long, TempText As String, Words() As String
  TempText = S
  For X = 1 To Len(TempText)
    If Mid(TempText, X, 1) Like "[!A-Za-z ]" Then Mid(TempText, X) = " "
  Next
  Words = Split(Application.Trim(TempText))
  For X = 0 To UBound(Words)
    If Words(X) <> StrConv(Words(X), vbProperCase) Or Len(Words(X)) = 1 Then Words(X) = ""
  Next
  ProperCaseWords = Application.Trim(Join(Words))
End Function


It worked perfect
Again Thank You Rick
 
Upvote 0
This is the UDF (user defined function) that I came up with...
Code:
Function UpperCaseWords(S As String) As String
  Dim X As Long, TempText As String
  TempText = " " & S & " "
  For X = 2 To Len(TempText) - 1
    If Mid(TempText, X, 1) Like "[!A-Z ]" Or Mid(TempText, X - 1, 3) Like "[!A-Z][A-Z][!A-Z]" Then
      Mid(TempText, X) = " "
    End If
  Next
  UpperCaseWords = Application.Trim(TempText)
End Function

HOW TO INSTALL UDFs
------------------------------------
If you are new to UDFs, they are easy to install and use. To install it, simply press ALT+F11 to go into the VB editor and, once there, click Insert/Module on its menu bar, then copy/paste the above code into the code window that just opened up. That's it.... you are done. You can now use UpperCaseWords just like it was a built-in Excel function. For example,

=UpperCaseWords(A1)

Thank you very much for this post!
It was very helpful and has saved me several hours of work!

Regardsn
 
Upvote 0
Hi Rick/Team

Is it possible to get the Numbers along with Upper case.
For example is a String have "MICROSOFT EXCEL2013 offers a great help.", Result should be - "MICROSOFT EXCEL2013"
 
Upvote 0

Forum statistics

Threads
1,214,645
Messages
6,120,711
Members
448,984
Latest member
foxpro

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