Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
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
 



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 08:58 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