Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-28-2017, 11:33 PM
ArviLaanemets ArviLaanemets is offline Separate First and Last and how to add to existing Macro Windows 8 Separate First and Last and how to add to existing Macro Office 2016
Expert
 
Join Date: May 2017
Posts: 949
ArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant future
Default

Having a full name in single column may be really a can of worms!

When you are sure both first and last names are always single names, you can use worksheet formulas - no need for VBA:
a) for leftmost name
=LEFT($A2,IF(ISERROR(FIND(" ",$A2;1)),LEN($A2),FIND(" ",$A2,1)))
b) for rightmost name
=IF(ISERROR(FIND(" ",$A2,1)),"",MID($A2,FIND("|",IF(ISERROR(FIND( " ",$A2,1)),"",SUBSTITUTE($A2," ","|",FIND(" ",$A2,1)-1)))+1,250))

When there is only a single name in FullName column ($A), the 2nd formula returns an empty string.
Instead of character "|" you can use any other character not being used in any of names.



Of course the formulas aren't helping when people have many-part first names (NB! Not first and middle names, but several first names!) or many-part last names (p.e. some women add husbands family name to her maiden family name) - but then doesn't VBA help too. And I hate to think about Spanish names at all
Reply With Quote
  #2  
Old 08-30-2017, 10:28 AM
delivery delivery is offline Separate First and Last and how to add to existing Macro Windows 7 64bit Separate First and Last and how to add to existing Macro Office 2016
Novice
Separate First and Last and how to add to existing Macro
 
Join Date: Aug 2017
Posts: 4
delivery is on a distinguished road
Default

We already are using a macro to clean up the excel file we are given each month so ideally we just want to add extra code to have to also separate the names so we do not have to do extra formula work and the last part is to split up these names but as previous post mentions there are a lot of Spanish names so there are multiple names not just first last.

The file has a combination of different name strings.

I basically want to get the first name and just the last name and ignore whatever is in the middle. Possible?
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro for creating word docs from existing template ferocious12 Word VBA 5 02-04-2017 09:57 PM
Separate First and Last and how to add to existing Macro Tweak Macro to Save Each Page of Word Document as Separate PDF or Doc File? Hewg74 Word VBA 3 08-22-2016 05:20 PM
Separate First and Last and how to add to existing Macro Can I use the filter function to separate letters into separate files? drhauser Mail Merge 2 12-14-2011 02:18 PM
How do you update existing Outlook calendar item from Word with macro? Joe Patrick Word VBA 0 07-09-2011 05:32 AM
Any easy way to separate a Word document into separate files? SamHelm Word 0 08-21-2010 05:29 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:20 PM.


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