Excel Text 4 of 4: Using SUBSTITUTE to Parse Text

Excel is great at splitting text across multiple columns. For basic text separation (e.g. putting first and last name in separate columns) the LEFT and RIGHT functions work fine. But these functions fall short when applied to data that follow an inconsistent pattern. In the below example, the errant inclusion of a middle name wrecks havoc with our formula results.

Text4Substitute(2)

Using the SUBSTITUTE function one can identify and replace the last space in the cell with a uniquely identifying character (e.g., an underscore). This character can then be used as a delimiter to separate Lastname from full name.

ScreenShot-2015-Jun-03-126-AM

SUBSTITUTE: replace character(s) within a cell with specified character(s)

= SUBSTITUTE ( text, old text, new text, instance)
Note, instance is optional; when omitted, every occurrence of old text is replaced with the new.

Examples:

  • =SUBSTITUTE(“Mad Max”, a,i) returns Mid Mix
  • =SUBSTITUTE(“mississippi, i,“”) returns msssspp
  • =SUBSTITUTE(“banana”, a,Q”,2) returns banQna
LEN Counts the number of characters =LEN(antidisestablishmentarianism) returns 28

Click here for a 5 minute tutorial:

Cheers!

hɔuᴉnb

Additional reading:

%d bloggers like this: