Help with Extracting Names from a Cell

jstarr

New Member
Joined
Dec 1, 2014
Messages
20
I'm a huge baseball fan and I'm trying to extract a name from a spreadsheet I have. The names are listed with the position, and team all in one cell.

Example below:

[TABLE="width: 300"]
<colgroup><col></colgroup><tbody>[TR]
[TD]Mike Trout CF | LAA [/TD]
[/TR]
[TR]
[TD]Miguel Cabrera 1B | DET


How can I extract Mike Trout, and Miguel Cabrera from cells A3 and A4?[/TD]
[/TR]
</tbody>[/TABLE]
 

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
Have you tried using the Text To Columns option with the space as the delimiter?
 
Upvote 0
Is the format always the same: First Last Position | Team? If so, use the left function:

=TRIM(LEFT(A1,FIND(" ",A1,FIND(" ",A1,1)+1)))

Where A1 contains your first player's name.
 
Upvote 0
I was hoping I didn't have to go that route, since I'll have to then merge the first name and last name cells back together each time.
 
Upvote 0
Is the format always the same: First Last Position | Team? If so, use the left function:

=TRIM(LEFT(A1,FIND(" ",A1,FIND(" ",A1,1)+1)))
that could be problematic if there are any 2 word first names (or last names).

Better to rely on finding the |, assuming at least the Position is consistent (always 2 characters)

=LEFT(A1,FIND("|",A1)-5)
 
Upvote 0
that could be problematic if there are any 2 word first names (or last names).

Better to rely on finding the |, assuming at least the Position is consistent (always 2 characters)

=LEFT(A1,FIND("|",A1)-5)

So the formula works perfectly with 1 exception. Here's a name example: Buster Posey C | SF

In this case, it writes the name as Buster Pose since the position is only 1 letter. Any thoughts on how to resolve for these situations?
 
Upvote 0
What about: =LEFT(A1,FIND(" ",A1,FIND("|",A1)-5))

Just in case the OP is going to match these names down the road, then maybe this needs to be wrapped in Trim()

=TRIM(LEFT(A1,FIND(" ",A1,FIND("|",A1)-5)))

Just a thought...
 
Upvote 0
Can you be more specific? What did you try and on what?

Code:
      -----------A----------- ------B------- ----------------------C-----------------------
  1   Mike Trout CF | LAA     Mike Trout     B1:=TRIM(LEFT(A1,FIND(" ",A1,FIND("|",A1)-5)))
  2   Miguel Cabrera 1B | DET Miguel Cabrera                                               
  3   Buster Posey C | SF     Buster Posey
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,630
Messages
6,173,451
Members
452,514
Latest member
cjkelly15

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