Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-08-2016, 05:32 PM
BudVitoff BudVitoff is offline Split data from name field Windows 7 64bit Split data from name field Office 2007
Advanced Beginner
 
Join Date: Sep 2011
Posts: 52
BudVitoff is on a distinguished road
Default

I know I implied that I wouldn't bother you guys any more, but I just couldn't get it out of my mind. Thanks to my DVR, I solved this one first and watched the Superbowl later.



This solution is for the last name. I arbitrarily used A16 for the work row. Basically, it looks for the 1st space and an optional 2nd space. If the 1st space is alone, it takes the rest of the name starting at 1st space+1, otherwise it takes the rest of the name starting at 2nd space +1.

=(MID(A16,(IFERROR(FIND(" ",A16,(FIND(" ",A16)+1)),FIND(" ",A16)))+1,LEN(A16)))

FWIW, I assume that the full name has been pre-processed to preclude redundant or embedded spaces, per my previous little lecture.

Now I want to solve for the Middle Name, now that you appear to have expanded it from Middle Initial. Obviously if you want to stick with a consistent single-letter middle initial without any punctuation or additional letters, the change in the code will be trivial.

Later.

Last edited by BudVitoff; 02-09-2016 at 01:22 PM.
Reply With Quote
  #2  
Old 02-09-2016, 03:35 PM
BudVitoff BudVitoff is offline Split data from name field Windows 7 64bit Split data from name field Office 2007
Advanced Beginner
 
Join Date: Sep 2011
Posts: 52
BudVitoff is on a distinguished road
Default

Hey, I even got comfortable with the ISERROR!

To extract the middle name, work with the string in the full name starting after the 1st space, and try to deliver the number of bytes in the middle name: (position of 2nd space) - (position of 1st space) - 1. If this fails because there is no 2nd space, deliver a 0. This number becomes the third parameter of the MID function.

=MID(A16,FIND(" ",A16)+1,IFERROR((FIND(" ",A16,(FIND(" ",A16)+1))) - (FIND(" ",A16))-1,0))

To extract just the middle initial, look for a second space. If it's there, deliver the first letter of the middle name; otherwise deliver a null.

=IF(ISERROR(FIND(" ",A16,(FIND(" ",A16)+1))),"",(MID(A16,FIND(" ",A16)+1,1)))

Are we having fun yet?

Last edited by BudVitoff; 02-09-2016 at 09:39 PM.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to split merged data into vertical saperate cells cheekugreat Excel 5 10-11-2014 05:53 AM
Split data from name field How to format WORD data using edit field? Azuki Mail Merge 2 04-01-2013 06:08 PM
Merge field source data field kckay Mail Merge 4 03-25-2013 11:06 AM
Split data from name field Mail Merge - If a field is black, take the data from the row below? mikeprent Mail Merge 5 01-05-2012 04:52 AM
Split data from name field Split Data from One Cell Into Two Karen615 Excel 3 09-20-2011 06:36 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:48 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft