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
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
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)
 
Upvote 0
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>
 
Upvote 0
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.
 
Upvote 0
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),""))
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,525
Members
448,969
Latest member
mirek8991

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