To allow numbers, just add the 0-9 that I show in red below...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"
Code:
|
See Message #16Thank you so much Rick!!
what about the opposite? How can i exclude returning Uppercase that contains numbers?
For example string "MICROSOFT EXCEL2013 Special Edition", Result should be "MICROSOFT"
When you respond to my questions above, please ignore the fact that I forgot to make the words upper case... I am interest in the "structure" for the questions I asked, not the fact that I forgot to upper case them.Ah, I see what you mean. Just to point out, your upper case words request is different from the OP of this thread. With that said, I think you will have to help define what a "word" is. For example, is one-two (words with dashes between them) a single word, two independent words or not a word at all? Same question about one_two and one.two and one/two and one:two and probably others.
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)
=TRIM(RIGHT(SUBSTITUTE(A22," ",REPT(" ",100)),100))
You can use a formula. Is there only one first name?