Complicated formula to dissect a name into multiple columns

mrzackmullins

New Member
Joined
Mar 27, 2018
Messages
4
Hello,

I've found a few formulae to do close to what I'm looking to do. Short story: I have a report that pastes into an excel "tool" that then digests information and merges it into a word form via mail merge. It generates as many as 1000 forms per day, so it's important to get things correct on the first try.

The report generates names in this format LASTNAME, FIRSTNAME MI where a name looks like this Smith, John H

I have a cell that captures the last name perfectly as it stops at the comma, but the other cell manages to capture the First and MI as it backtracks to the comma (but I don't want the MI attached to the first name).

The formula that I'm looking to somehow modify to eliminate the MI is as follows.

=RIGHT(A1,LEN(A1)-FIND(",",A1,1))


I'm a bit new to the LEFT/RIGHT and TRIM functions as I don't regularly have a need to use them, but the Word Document needs to isolate just the first name so this is unfortunately necessary. Any suggestions?
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Hello mrzachmullins

The cell entry sample you gave is delimited by a space, so you may want to look into Text-To-Columns to facilitate this. Text-To-Columns will look at the cell entry and divide it into Columns whenever it sees a dilimiter.

Also, if you still wnat to use a formula, then:
This will get you the last name: =CLEAN(TRIM(LEFT(A1,FIND(",",A1,1)-1)))
This will get you the first name: =CLEAN(TRIM(MID(A1,FIND(", ",A1,1)+1,E5-FIND(", ",A1,1))))
This will get you the MI: =CLEAN(TRIM(MID(A1,E5,FIND(" ",A1,E5))))

I did these from my head but you get the concepts.

Hope this helps
 
Upvote 0
try this custom, usage:
=getFirstName(A2)

Code:
Function getFirstName(ByVal pvWord)
Dim vFirst, vLast
Dim i As Integer, j As Integer


i = InStr(pvWord, ",")
'vLast = Left(pvWord, i - 1)
j = InStrRev(pvWord, " ") - 1
vFirst = Mid(pvWord, i + 1, j - i)
getFirstName = Trim(vFirst)
End Function
 
Upvote 0
Hello mrzachmullins

This will get you the last name: =CLEAN(TRIM(LEFT(A1,FIND(",",A1,1)-1)))
This will get you the first name: =CLEAN(TRIM(MID(A1,FIND(", ",A1,1)+1,E5-FIND(", ",A1,1))))
This will get you the MI: =CLEAN(TRIM(MID(A1,E5,FIND(" ",A1,E5))))

I did these from my head but you get the concepts.

Hope this helps

I'm not sure what you're referencing with E5 so I can't attempt these formula options. If you explain what this is referring to I can amend the formula to see if it will work.


Thank you for your help!
 
Upvote 0
I should also say that I'm trying to limit VBA usage in this document for multiple reasons, but thank you for the assist ranman256
 
Upvote 0
Hi,

Try these, works for names With or Without middle name or initial:


Book1
ABCD
1Smith, John HSmithJohn
2Smith, JohnSmithJohn
3Smith, John JaySmithJohn
Sheet6
Cell Formulas
RangeFormula
C1=LEFT(A1,FIND(",",A1)-1)
D1=TRIM(LEFT(SUBSTITUTE(MID(A1,FIND(",",A1)+1,255)," ",REPT(" ",50)),100))
 
Last edited:
Upvote 0
You're welcome, welcome to the forum.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,876
Members
452,363
Latest member
merico17

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