Download as xls, pdf, or txt
Download as xls, pdf, or txt
You are on page 1of 8

HOW TO EXTRACT FIRST NAMES AND LAST NAMES FROM A FULL NAME

FULL NAME FIRST NAME LAST NAME


Delos Santos, Jack Robert Jack Robert Delos Santos
Manalang, Booie Booie Manalang
Repalda, Teki Abary Teki Abary Repalda
Repalda, Ma Teresina Remedios Ma Teresina Remedios Repalda

Extracting First Names and Last Names without using Text to Columns
To those of you who have attended my Intermediate to Advanced Excel classes and wanted to find a better way of extra
have double Spanish surnames like Delos Santos or Delos Reyes or those that have too many first names like mine: there
without using the cumbersome text to columns feature in Excel. For advanced users, this also does away with WMID fu

Formula features included here indicated in the following steps:


01 .FIND | This function finds the the character placement of the "separator" (in this case the comma) within the full na
02. REPLACE | This function replaces characters within old text to new text by indicating what characters to extract and
03. TRIM | This function deletes spaces before and after the text
04. LEFT | This function retains characters from left of the position of the character you specified.

Explaining the syntax and how it is used here

FIND
First allow me to explain FIND. Determine the character that is the indicator for the separation between first name and
The syntax of FIND is =FIND(find_text, within text, [start number])

wherein find_text is the comma. This is typed into the formula as "," (Note that this includes comma enclosed in
and within_text is the full name. This is indicated by cell B4 (entry: Delos Santos, Jack Robert)

If we were to just use the function FIND, it will yield the following results

FULL NAME FIND result


Delos Santos, Jack Robert 13 means that the comma is the 13th character in the Jac
Manalang, Booie 9 means that the comma is the 8th character in Booie's n
Repalda, Teki Abary 8 means that the comma is the 8th character in my Rom
Repalda, Ma Teresina Remedios 8 means that the comma is the 8th character in my full S

REPLACE
To extract the First Name, we will use the REPLACE function together with the FIND formula.
The syntax of REPLACE is =REPLACE(old_text,start_num,num_char, new_text)

Let's try extracting Jack Robert Delos Santos' first name in the table below.

FULL NAME FIRST NAME


Delos Santos, Jack Robert Jack Robert

In C45, we wrote the formula =REPLACE(B45,1,FIND(", ",B45),"")


B45 carries Jack's full name which is the old_text parameter (Delos Santos, Jack Robert)
1 is the starting character which we want to get replaced. In this case that means from the character
The entire FIND function is the num_char parameter. This means that the replacement should end after the 13th char
The new_text is indicated by the null or space enclosed in quotations.

With the REPLACE formula I am simply telling Excel that in the full name "Delos Santos, Jack Robert
convert it to space or " ". The equation will then leave me with " Jack Robert"

TRIM
Now eventhough this leaves me with Jack's first name, note that there is a space before his name. For data scrubbers, th
In order to eliminate the space, we shall use the TRIM function to encompass the REPLACE equation. TRIM simply delete
The syntax of TRIM is =TRIM(text)

Let me give you an example below:


NAME WITH SPACES TRIMMED NAME
Rocky Sunico Rocky Sunico
Saveron, Neal Janvier Saveron, Neal Janvier

So to combine REPLACE with TRIM, we are just going to encompass the entire REPLACE formula that we used earlier for

It results to the table below:


FULL NAME FIRST NAME
Delos Santos, Jack Robert Jack Robert

LEFT
So far, we’ve used FIND, REPLACE and TRIM to extract First Names from a full name. Now, how about for Last Names?
To extract the Last Name, we will use the LEFT function to display only characters to the left of the character you specifie

The syntax of LEFT is =LEFT(text, num_char)

wherein text is the full name. This is indicated by cell B4 (entry: Delos Santos, Jack Robert)
and num_char is the number of characters to the left of the separator character you specified.
In this case, we shall use the FIND function to indicate the num_char parameter.

In the case of the table below, the FIND equation is stated as FIND(",",B87) which means that it needs to find the comm
However, you will note that I expanded the formula by using this instead FIND(",",B86)-1 This means that I need not

So in typing in the following LEFT equation: =LEFT(B88, FIND(",",B88)-1), I am therefore asking Excel to retain all ch

FULL NAME LAST NAME


Delos Santos, Jack Robert Delos Santos
Summary and Acknowledgements
I hope that you have learned something today. To get a fuller appreciation of how Excel and its many wonderful tricks, y
outside work, you can simply leave a message on FB profile or email me directly at my personal email address.

The names used in this spreadsheet are those of real people. At some point in time, we have all worked together and ha
Jack Robert Schaeffer Delos Santos is a Quality Manager at Rogers Telecommunications in Canada.
Booie Manalang is Senior Manager for Insight Analytics at Sykes Enterprises, Inc.
Rocky Sunico is Manager for Audit, Compliance and Product Training at VXI Global Solutions.
Neal Janvier Saveron is IT HR Scheduling Manager at Accenture.

This is meant to remember all QA teams through the years: QA Systems Group circa 2001-2004, Ambergris QA Team 2004 (esp. Chr
wanted to find a better way of extracting last names especially those of who
oo many first names like mine: there is now an easier way to extract them
, this also does away with WMID functions in MoreFunc.xla add-ins.

case the comma) within the full name text. This is case-sensitive.
ting what characters to extract and what it will be replaced with.

ou specified.

separation between first name and last name. In this case, that's the comma

his includes comma enclosed in quotations.)


Jack Robert)

mma is the 13th character in the Jack's full name


mma is the 8th character in Booie's name
mma is the 8th character in my Romaji name (with middle name)
mma is the 8th character in my full Spanish given name
om the character D onwards. This is the start_num parameter.
ment should end after the 13th character

os, Jack Robert" I need it to delete "Delos Santos, " and simply

ore his name. For data scrubbers, this becomes a data cleansing nightmare.
PLACE equation. TRIM simply deletes all spaces before and after a text.

CE formula that we used earlier for Jack's name.

Now, how about for Last Names?


the left of the character you specified. Characters to the right are then removed.

u specified.

means that it needs to find the comma as a separator.


86)-1 This means that I need not include the comma and the space in the extraction.

herefore asking Excel to retain all characters to the left of the comma without including the comma.
xcel and its many wonderful tricks, you are invited to attend our in-company classes. Or for my friends
y personal email address.

we have all worked together and have had many Excel discoveries:

04, Ambergris QA Team 2004 (esp. Chris & Loucelle), TQD/W, Team SCOPE and Project SCRUB.
HOW TO COMPARE TWO DIFFERENT LISTS

LIST ONE LIST TWO IS LIST ONE IN LIST TWO? IS LIST TWO IN LIST ONE?
Aquino, Benigno III Villar, Manny 0 1
Gordon, Richard Ejercito, Joseph 1 0
Villar, Manny Obama, Barack 1 1
Madrigal, Consuelo Gordon, Richard 0 1
Obama, Barack Teodoro, Gilbert 1 0

Comparing Individual Entries Between Two Lists


LIST ONE LIST TWO UNIQUE LIST
Aquino, Benigno III Villar, Manny Aquino, Benigno III
Gordon, Richard Ejercito, Joseph Gordon, Richard
Villar, Manny Obama, Barack Villar, Manny
Madrigal, Consuelo Gordon, Richard Madrigal, Consuelo
Obama, Barack Teodoro, Gilbert Obama, Barack
Ejercito, Joseph
Teodoro, Gilbert
#N/A

You might also like