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

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

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,334
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,334
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,109,413
Messages
5,528,632
Members
409,828
Latest member
99DodgeRam

This Week's Hot Topics

  • Change military grades into rank
    Afternoon all Need help with formula that will change military rank (i.e. 1, 2, 3 into Amn, A1C, SrA). Running IF formula that does not work...
  • VBA COUNTIF SOLUTION
    Hi The following are the errors spread across the several columns from E to Q ie. 13 columns across several sheets with more than 500 rows per...
  • INSERT ROW WITH SPECIFIS TEXT IN A COLUMN
    Hi All! How can identify that that the row to be inserted has to be inserted before 1st row with specific text in column F. If I record the...
  • Auto-Create a monthly Sign in sheet for preschool students
    The image below is what each page looks like. Above is space for the "Child Name" "Month" "Class" School days are obviously Monday-Friday but...
  • VBA vlookup multiple results
    Hi folks, Hopefully someone out there can help. I have a list to vlookup which works (ish). the lookup only picks up the first instance of the...
  • Extract values for earliest/latest times
    I am trying to put together a formula to get the earliest start time, the latest end time from column A for each person in Column B-F without the...
Top