Training & Facilitation

When Text-to-Columns Fails

Excel’s Text-to-Columns can fix issues with full names like “van der Merwe” using custom formulas and Name Manager.

Abstract image of a spreadsheet on a laptop.

A functional Van der Merwe story

In a column of full names containing first, middle and last names, Excel’s Text-To-Columnsfunction fails with last names like “van der Merwe”. To get around this, using Names Manager, we’ll create our own text functions standing on the broad shoulders of some text functions already available in Excel: FIND, LEFT, LEN, MID, RIGHT, SUBSTITUTE, against a full name in cell $A2:

  • Trim any leading/trailing spaces in Full Names to avoid errors
  • NoSpaceLen uses SUBSTITUTE to replace spaces with nothing.
  • LenFull returns the string length including spaces
  • SpacesCount subtracts the NoSpaceLen from LenFull to return count of spaces in original
  • NoMiddleName is true if there are less than 2 spaces
  • SpaceOnePos returns position of first space in $A2
  • SpaceTwoPos returns position of the second space: It uses SUBSTITUTE to replace the 2nd space found with a pipe character, and then FIND to return the pipe character’s position

Now, we can create functions to return First, Middle and Last names:

A traditional (non-Names Manager) middle name formula may seem like an easier approach – until you try to debug it:

=IF(ISERR(FIND(” “;$A2;1+FIND(” “;$A2)));””;MID($A2;FIND(” “;$A2)+1;FIND(” “;$A2;1+FIND(” “;$A2))-FIND(” “;$A2)-1))

NOTE: Both, like Text-To-Columns, will fail on “AB de Villers”. Just saying.

Jasper Cook

Bio: This article was written by Jasper Cook, Excel guru and trombonist of note. Call or email us if KRS and Jasper can assist you with your Excel: enquiries@krs.co.za

Looking for a software partner?

Tell us about your project and we’ll show you how our team can help.

Contact Us

Found this useful? Share it.

Written by

KRS

More musings →

Keep reading

Selection of software book covers in a collage Training & Facilitation

27 May 2025 · Lor Steyn

Our recommended books for writing better code

Our top recommended books to improve code quality, design, and organisation, from DDD and TDD to software design classics and best practices.

Minimum Viable Product - MVP Training & Facilitation

1 December 2022 · KRS

Define your Minimum Viable Product (MVP) with KRS

KRS has proven processes to identify your MVP (Minimum Viable Product). Get your product to market as soon as possible with our expertise

KRS Product Owner Graphic Training & Facilitation

29 October 2022 · KRS

KRS Product Owner services in a nutshell

KRS provides clients with senior Product Owner services - a key role in the development and successful delivery of a software solution.