Text functions: clean data with formulas
Data copied from another system is often messy: codes that pack several facts together, names in capitals, extra spaces, and numbers that won't add up. Text functions fix it with a formula, so the same fix runs on every row.
LEFT, RIGHT and MID take apart codes, UPPER, LOWER and PROPER fix capitals, TRIM removes extra spaces, and &, CONCAT and TEXTJOIN join names. VALUE turns text into numbers you can add up, and SUBSTITUTE, FIND and SEARCH swap and find characters.
Lessons in this topic
- 1Take part of a text with LEFT, RIGHT and MIDPlusAbout 5 minutes
Pull parts out of codes and IDs with LEFT, RIGHT and MID in Excel and Google Sheets: the start, the end, or a piece from the middle.
- 2Count characters with LENPlusAbout 4 minutes
Use LEN to count the characters in a cell, and spot mobile numbers that are too short or too long before they cause trouble.
- 3Fix capitals with UPPER, LOWER and PROPERPlusAbout 4 minutes
Tidy names and cities typed in the wrong capitals with PROPER, UPPER and LOWER, so every row of the list looks the same.
- 4Join text with &, CONCAT and TEXTJOINPlusAbout 6 minutes
Join first and last names, add labels, and build full addresses with &, CONCAT and TEXTJOIN in Excel and Google Sheets.
- 5Remove extra spaces with TRIMPlusAbout 5 minutes
Clean names pasted from other systems with TRIM: it removes spaces at the start and end, and squeezes double spaces down to one.
- 6Turn text into numbers with VALUEPlusAbout 5 minutes
Numbers pasted from a PDF or website often arrive as text, and SUM skips them. Use VALUE to turn them back into numbers you can add up.
- 7Swap characters with SUBSTITUTEPlusAbout 5 minutes
Use SUBSTITUTE to remove a currency sign, swap spaces for dashes, or replace any text inside a cell, then turn prices back into numbers.
- 8Find text inside a cell with FIND and SEARCHPlusAbout 5 minutes
Use FIND and SEARCH in Excel and Google Sheets to get the position of text in a cell, with or without matching capitals, and with wildcards.
- 9Split names and take text before a characterPlusAbout 6 minutes
Split a full name into first and last name, and take the text before or after a character, with LEFT, MID and FIND in Excel and Google Sheets.