Splitting characters based on conditions into different cells

johnmerlino

Board Regular
Joined
Sep 21, 2010
Messages
94
Hey all,

I have a list that looks like this:

AVERNA,ROBERT C H/E
Corn,Marlin Calvin LIV
CATANESE,SALVATORE J & OLGA M
JIMENEZ,ALEJANDRO & HILDA M
Cortes,Alessandra M Marquez
CATANESE,SALVATORE J & OLGA M & Nunez, Jason P

The conditions:
* If comma delineater between last and first name and there is no ampersand (&) in field, then delete everything after the middle initial/name, if the contents after the middle initial/name is three characters or less.
* If comma delineater between last and first name and there is an ampersand (&) in field, concatenate the last name, which is always to the far left, to the first and middle initial (if one exists) located after the ampersand into the second column and remove everything after the ampersand, including the ampersand in the first column. In otherwords, we have two names in two different columns, both with same last name.
* If comma delineater between last and first name and there is a string more than 3 characters long after the middle initial, then move the entire column exactly as it is into the third column. This indicates that the person has two last names.
* If comma delineater between last and first name and there are two ampersands (&) in field, if the contents after one only has two strings where one to right is more than 3 characters, then move that two column 2 with the last name to far left and move the one after second ampersand to column 3 if same condiiton, but if that has a comma delineater, then don't concatenate it with name to far left, rather just keep it as is and move it to the third column. So this: CATANESE,SALVATORE J & OLGA M & Nunez, Jason P would look like this: CATANESE,SALVATORE J CATANESE, OLGA M Nunez, Jason P

Is it possible to place all these conditions in a single line so that I just apply to entire list?
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Forum statistics

Threads
1,223,228
Messages
6,170,871
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