Solved

# Excel - Cell  text splitting

Posted on 2014-09-11
126 Views
Hi,

LASTNAME                     FIRSTNAME
BARGAS FORREA, JOSE LUIS (intern)
BARGAS FORREA, JOSE LUIS
OUSSAINT, JULI (EXTERN)
OUSSAINT, JULI (Z123456)
OUSSAINT, JULI

For Firstname i have  example:   BARGAS FORREA, JOSE LUIS (intern)
=RIGHT(B2,(LEN(B2))-(SEARCH(",",B2))-1)   the result is:  JOSE LUIS (INTERN)     should be JOSE LUIS

For Lastname i have  example:    BARGAS FORREA, JOSE LUIS (intern)
=LEFT(B9,(LEN(B9))-(SEARCH(",",B9))+0)    the result is :BARGAS FORREA, JOSE   should be  BARGAS FORREA

The formula should work with all given examples.  Is that possible?

0
Question by:Mandy_

LVL 31

Assisted Solution

Rob Henson earned 500 total points
ID: 40316640
For First Name, will all data include the intern/extern in brackets?

If so:

=TRIM(MID(B9,FIND(",",B9,1)+1,FIND("(",B9,1)-FIND(",",B9,1)-1))

For last name, try using:

=MID(B9,1,(SEARCH(",",B9))-1)

LEN(B9) = 33
SEARCH(",",B9) gives 14
33 - 14 = 19

The 19 leftmost characters includes ", JOSE"

Thanks
Rob H
0

LVL 31

Accepted Solution

Rob Henson earned 500 total points
ID: 40316646
If nothing in brackets:

=TRIM(MID(B9,FIND(",",B9,1)+1,IFERROR(FIND("(",B9,1)-FIND(",",B9,1)-1,LEN(B9))))
0

LVL 19

Expert Comment

ID: 40316658
what if you use Text to columns?
you will use delimiter to split cell. In first step you will use comma (,) so you split Last name from the rest. Because for some records you have brackets () you will do another Text to columns where delimiter is left bracket (. With this step you will get First name (in 1st step you get last name in A column, in this 2nd step you get First name in the B column). The rest placed in C column (text like INTERN, EXTERN, ####, ...) and you can delete this column if you do not need it.
0

LVL 50

Expert Comment

ID: 40316659
Hello,

it might be easiest to use the Text to Column command on the data ribbon. First use the comma as the deliminator. This will split the last names and the first names. Then you can select the first names and use the text to columns to split at the  "(" sign. After that you can delete the column with the content that was in the brackets.
0

LVL 2

Author Closing Comment

ID: 40316677
perfect as usual. Thank you so much , rob
0

## Join & Write a Comment Already a member? Login.

What is a Form List Box? (skip if you know this) The forms List Box is the alternative to the ActiveX list box. If you are using excel 2007, you first make sure you have a developer tab (click the Orb)->"Excel Options"->Popular->"Show Developer tab…
Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

#### 758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

#### Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!