Splitting Imported "Last,First" Names

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am importing an Excel spreadsheet with where the name column is either an organization or LastName,FirstName. I am able to split off the LastName using Left and Instr functions. How do I get the FirstName out. I keep getting either a partial first name or part of the last name. The LastName and FirstName are variable in length.
 
Mid([FullName], InStr([FullName], ",")+1)

--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX


GAKDEV said:
I am importing an Excel spreadsheet with where the name column is either
an organization or LastName,FirstName. I am able to split off the LastName
using Left and Instr functions. How do I get the FirstName out. I keep
getting either a partial first name or part of the last name. The LastName
and FirstName are variable in length.
 
You use Left, Mid and Instr and search for the comma separator value.

Instr tells you the position of the comma.

e.g.
Fallon, Joe

The comma is in postion 7 above.
So the last name is Left(str,7-1)

First Name is Mid(str,7+1)

You replace the 7 with your Instr function that finds the comma.
--
Joe Fallon
Access MVP



GAKDEV said:
I am importing an Excel spreadsheet with where the name column is either
an organization or LastName,FirstName. I am able to split off the LastName
using Left and Instr functions. How do I get the FirstName out. I keep
getting either a partial first name or part of the last name. The LastName
and FirstName are variable in length.
 
Back
Top