Excel string need to divide the Cap words from uncap words

Charles101

New Member
Joined
Sep 2, 2014
Messages
4
Hi,
Thanks in advance

I have an excel file that has a string of Uppercase & Lowercase words

example: PIZZA HUT Owner Charles
I need to separate my string of Uppercase & Lowercase words
cell 1 = PIZZA HUT
Cell 2 = Owner Charles (lowercase (except first letters)

my file isnt uniformed as some Uppercase or Lowercase words can be 1 word 2 , 3 , 4 words


any help would be appreciated

Charles
 

Some videos you may like

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Armando Montes

Well-known Member
Joined
Sep 2, 2008
Messages
505
Hi, try:
Code:
Function FirstCap(Cell As Range)
    For FirstCap = 1 To Len(Cell.Value)
       If Mid(Cell.Value, FirstCap, 1) Like "[a-z]" Then Exit For
    Next FirstCap
End Function
'=LEFT(A2,FirstCap(A2)-3)
 

Charles101

New Member
Joined
Sep 2, 2014
Messages
4
Hi,
Thanks for the quick reply

i tried the code but got back #NAME?

here is what I tried it on

ABBBN Jacob
ABE'S ROOFING & SIDING sv
ABEL Bsv
ABASEESZ Carol Jennifer
ABRAM Carol & David
ABSTRACT CORP
ACCOUNTING & MORE sv
ACCURATE CONSTRUCTION ms
ADLER Abraham

what am i doing wrong ?


<colgroup><col></colgroup><tbody>
</tbody>
 

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
36,416
Office Version
  1. 2010
Platform
  1. Windows
i tried the code but got back #NAME?

here is what I tried it on

ABBBN Jacob
ABE'S ROOFING & SIDING sv
ABEL Bsv
ABASEESZ Carol Jennifer
ABRAM Carol & David
ABSTRACT CORP
ACCOUNTING & MORE sv
ACCURATE CONSTRUCTION ms
ADLER Abraham

what am i doing wrong ?

<tbody>
</tbody>

Give this UDF a try instead...
Code:
Function ALLCAPS(S As String) As String
  Dim X As Long
  For X = Len(S) - 1 To 1 Step -1
    If Mid(S, X, 2) Like "[A-Z][A-Z]" Then
      ALLCAPS = Left(S, X + 1)
      Exit For
    End If
  Next
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 ALLCAPS just like it was a built-in Excel function. For example,

=ALLCAPS(A1)

If you are using XL2007 or above, make sure you save your file as an "Excel Macro-Enabled Workbook (*.xlsm) and answer the "do you want to enable macros" question as "yes" or "OK" (depending on the button label for your version of Excel) the next time you open your workbook.
 

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
36,416
Office Version
  1. 2010
Platform
  1. Windows
Give this UDF a try instead...
Code:
Function ALLCAPS(S As String) As String
  Dim X As Long
  For X = Len(S) - 1 To 1 Step -1
    If Mid(S, X, 2) Like "[A-Z][A-Z]" Then
      ALLCAPS = Left(S, X + 1)
      Exit For
    End If
  Next
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 ALLCAPS just like it was a built-in Excel function. For example,

=ALLCAPS(A1)

If you are using XL2007 or above, make sure you save your file as an "Excel Macro-Enabled Workbook (*.xlsm) and answer the "do you want to enable macros" question as "yes" or "OK" (depending on the button label for your version of Excel) the next time you open your workbook.

Follow-Up: Assuming the name cell is A1 and you put the above formula in cell B1, then this formula in C1 will give you the remainder of the text...

=TRIM(REPLACE(A1,1,LEN(B1),""))
 

Charles101

New Member
Joined
Sep 2, 2014
Messages
4
Hi Rick,
I was in middle of writing a followup question on how to get the remainder, but you beat me to it,
It works SUPER,
as a fellow New Jerseyan I thank you for your time & expertise
I will use these codes/formulas a lot

May G-D Bless America & May G-D Bless You
 

Watch MrExcel Video

Forum statistics

Threads
1,114,020
Messages
5,545,535
Members
410,690
Latest member
navneetr
Top