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"
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
my apologies it's Asc not Chr, the below function will pull MICROSOFT EXCEL in but it will also pull in the J from June. Maybe this is a place you can start.

Function UPPERONLY(a)


Dim t As String


For i = 1 To Len(a)


If Asc(Mid(a, i, 1)) <= 65 Or Asc(Mid(a, i, 1)) <= 90 Then
t = Asc(Mid(a, i, 1)) & t
End If


Next i


UPPERONLY = t


End Function
 
Upvote 0
To my knowledge you would need to create a specialized function in vb using a loop and the chr function.

I´m not a very skillful Excel user (as you see) don´t you have any suggestion using vb (I don´t know how to use it)
Thanks
 
Upvote 0
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"
Since you can have other upper case text (the J in June for example) that you do not want to retrieve, you will need to give us more details about the text you want to retrieve. Will, for example, the upper case text you want to retrieve always start as the location where the first upper letter appears (as shown in your example)? If not, can you give us some other criteria to identify the text?
 
Upvote 0
Also I need to do a slight correction to the vb.

I'll assume that you are using 2007 or later. Press ctrl + F11 to open the VB window. Click on Insert and insert a new module. Paste the code into the module. You can then type the function in a cell within that workbook. If you want the function to work in any workbook at any time that will take a little more explaining, also I would need more information if you don't want the "J" from June.

Function UPPERONLY(a)


Dim t As String


For i = 1 To Len(a)


If Asc(Mid(a, i, 1)) <= 65 Or Asc(Mid(a, i, 1)) <= 90 Then
t = Mid(a, i, 1) & t
End If


Next i


UPPERONLY = t


End Function
 
Upvote 0
Also I need to do a slight correction to the vb.

I'll assume that you are using 2007 or later. Press ctrl + F11 to open the VB window. Click on Insert and insert a new module. Paste the code into the module. You can then type the function in a cell within that workbook. If you want the function to work in any workbook at any time that will take a little more explaining, also I would need more information if you don't want the "J" from June.

Function UPPERONLY(a)

Dim t As String

For i = 1 To Len(a)

If Asc(Mid(a, i, 1)) <= 65 Or Asc(Mid(a, i, 1)) <= 90 Then
t = Mid(a, i, 1) & t
End If

Next i

UPPERONLY = t

End Function
Our common question about things like the "J" in "June" notwithstanding, I just want to point out that your function removes spaces as well as non-uppercase letters; the OP wrote in his first message...

'How can I get only the words "MICROSOFT EXCEL"'

Note he shows the internal space character as being preserved.
 
Upvote 0
Our common question about things like the "J" in "June" notwithstanding, I just want to point out that your function removes spaces as well as non-uppercase letters; the OP wrote in his first message...

'How can I get only the words "MICROSOFT EXCEL"'

Note he shows the internal space character as being preserved.

I´m using Excel 2010, and I don´t want the letter "J" from "June" only the words in upper case

Thanks
 
Upvote 0
Hi

Will the uppercase words always be together, like in the example, or can there be other words in between, like

"MICROSOFT has the spreadsheet program EXCEL."

In that case you want all those words separated by spaces?
 
Upvote 0

Forum statistics

Threads
1,215,237
Messages
6,123,800
Members
449,127
Latest member
Cyko

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