LEFT or RIGHT Formula?

audrey

Active Member
Joined
Jul 30, 2008
Messages
491
Hello,

I have these similar written in my excel worksheet. Is there a way to have the Name and Surname only ? It looks like I need a formula would find the " - " and take the rest.

Input
311-31 - AUDREY SURNAME
311-3135 - AUDREY2 SURNAME

Expected Output
AUDREY SURNAME
AUDREY2 SURNAME

Thanks in advance.

Gokhan
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
If we can assume the " - " (space hyphen space) is a constant...It always precedes the name you want.

Try
=REPLACE(A1,1,FIND(" - ",A1)+2,"")
 
Upvote 0
Hello,

I have these similar written in my excel worksheet. Is there a way to have the Name and Surname only ? It looks like I need a formula would find the " - " and take the rest.

Input
311-31 - AUDREY SURNAME
311-3135 - AUDREY2 SURNAME

Expected Output
AUDREY SURNAME
AUDREY2 SURNAME
Assuming your surnames are never one of the "modern-style" combined/hyphenated last names, you can use this formula...

=TRIM(RIGHT(SUBSTITUTE(A1,"-",REPT(" ",99)),99))

Edit Note: If the spaces around the last hyphen will always be there, then use Jonmo1's formula (it would avoid the problem with hyphenated last names that I mentioned).
 
Last edited:
Upvote 0
Audrey,

How about:


Excel 2007
AB
1311-31 - AUDREY SURNAMEAUDREY SURNAME
2311-3135 - AUDREY2 SURNAMEAUDREY2 SURNAME
3
Sheet1
Cell Formulas
RangeFormula
B1=TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",50)),100))
B2=TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",50)),100))
 
Upvote 0
Audrey,

Thanks for the feedback.

You are very welcome. Glad we could help.

And, come back anytime.
 
Upvote 0
Excel 2007
AB
1311-31 - AUDREY SURNAMEAUDREY SURNAME
2311-3135 - AUDREY2 SURNAMEAUDREY2 SURNAME
3

<COLGROUP><COL style="BACKGROUND-COLOR: #e0e0f0"><COL><COL></COLGROUP><THEAD>
</THEAD><TBODY>
</TBODY>
Sheet1

Worksheet Formulas
CellFormula
B1=TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",50)),100))
B2=TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",50)),100))

<THEAD>
</THEAD><TBODY>
</TBODY>

<TBODY>
</TBODY>
Just to point out, your formula will not produce the correct results for names with double-word first or last names. For example, I used to work with someone whose given first name was "Mary Ann" (with the space between them... Ann was not her middle name) and another whose last name was "Della Rossa" (again, with the space between them... Della was not his middle name).
 
Upvote 0

Forum statistics

Threads
1,214,598
Messages
6,120,441
Members
448,966
Latest member
DannyC96

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