Excel Formula - How to separate full name

shacol03

New Member
Hi,


Please help me regarding these below:


1st. How to get all capital letters in a cell. I want to get only the "DEL REY(AM)"

Sample: Alejandro Jay DEL REY(AM)


2nd. How to get the remaining full first name. I want to get only the "Alejandro Jay"




Thank you.
 

kweaver

Well-known Member
There are a few ways. If you have Excel 365 or so, you can put: Alejandro Jay into B1 (assuming the full string is in A1) and then use Flash Fill from the DATA tab on the ribbon.
The same would apply to the location by typing JUST THE LOCATION (e.g., Del Ray(AM)) into C1 and using Flash Fill.

If not, you can extract just the name, assuming there is a space between the first and last name and a space after the last name, using:

Code:
=LEFT(A1,FIND(" ",A1,FIND(" ",A1)+1)-1)
You can extract everything AFTER the space which is after the last name using:

Code:
=RIGHT(A1,LEN(A1)-FIND(" ",A1,FIND(" ",A1)+1))
 
Last edited:

shacol03

New Member
Hi kweaver,

But can you help me how to get only the big letter in a Cell,
Example
1. Alejandro Jay DEL REY(AM), then I want only to get all capital letter which is "DEL REY(AM)"
2.
Filippo BERGAMASCHI , will get only the BERGAMASCHI


Regards,
 

tyija1995

Well-known Member
Hey,

If the format is consistent in that the capitals always come at the end (and there are no other funny characters such as "[" etc) then try this:

Code:
Function NONCAPITALS(txt As String) As String
Dim rgx As Object
Set rgx = CreateObject("VBScript.RegExp")
    rgx.Global = True
    rgx.Pattern = "([A-Z]{2,})"
    NONCAPITALS = rgx.Replace(txt, "")
End Function
To use - lets say A1 = "Alejandro Jay DEL RAY(AM)"
B1:
Code:
TRIM(SUBSTITUTE(SUBSTITUTE(NONCAPITALS(A1),CHAR(40),""),CHAR(41),""))
C1:
Code:
TRIM(REPLACE(A1,1,LEN(B1),""))
B1 result: "Alejandro Jay"
C1 result: "DEL RAY(AM)"
 

AlKey

Active Member
Try this
Enter formula in cell B1 and drag formula across to C1

Code:
[B]=TRIM(MID(SUBSTITUTE(SUBSTITUTE($A1," ",",",2),",",REPT(" ",50)),50*(COLUMNS($A:A)-1)+1,50))[/B]
 

Some videos you may like

This Week's Hot Topics

  • Get External Data (long shot question!)
    This is likely a long shot but I am wondering if it is at all possible for Excel to somehow 'change' the contents of a URL that is being linked to...
  • Importing multiple excel files into one spreadsheet
    Hi, I'm trying to import multiple excel files (with the same format into a single spreadsheet) so that each day's file is listed underneath the...
  • Cell Formatting
    Good Morning, I need to format a few different cells in the following manners: A1 has to always add a colon (:) after whatever is typed in by a...
  • How to copy multiple rows using If
    Hi all, I'm very new to VBA and have written this simple code to copy certain cells if a certain cell within that row contains any data. I need...
  • Workbook_Change stopped working !
    I am working on an app to speed up & automate processing of Credit Cards statements. After data is input from a CSV file, it is presented to the...
  • VBA If statement
    Dear All, I have two dates, where I'd like a message box to pop, if the dates are between this criteria. [CODE] sDate1 = #10/1/2019#...
Top