Free Excel Formula Course / Lesson 3 of 10

Excel Text Formulas: Clean, Extract, and Join

Normalize imported text, extract parts of identifiers, find and replace characters, combine fields, and create readable labels.

Lesson 3: Text is data too

Imported CSV files, names, product codes, and addresses often contain inconsistent spacing or mixed formatting. These functions return text unless noted otherwise. In the examples, A2 contains " North-042 ".

Text formula reference

FunctionPurposeExample and result
TRIMRemoves leading/trailing spaces and reduces repeated ASCII spaces to one.=TRIM(A2) returns North-042.
CLEANRemoves non-printing characters from imported text.=CLEAN(A2) removes control characters.
UPPERConverts letters to uppercase.=UPPER("north") returns NORTH.
LOWERConverts letters to lowercase.=LOWER("NORTH") returns north.
PROPERCapitalizes the first letter of each word.=PROPER("ada lovelace") returns Ada Lovelace.
LEFTReturns characters from the start.=LEFT("North-042",5) returns North.
RIGHTReturns characters from the end.=RIGHT("North-042",3) returns 042.
MIDReturns characters from a position.=MID("North-042",7,3) returns 042.
LENCounts characters, including spaces.=LEN("North-042") returns 9.
FINDFinds text and is case-sensitive.=FIND("-","North-042") returns 6.
SEARCHFinds text and is not case-sensitive; wildcards are supported.=SEARCH("north",A2) returns 3 when A2 has two leading spaces.
SUBSTITUTEReplaces matching text; optional instance selects one occurrence.=SUBSTITUTE("1-2-3","-","/") returns 1/2/3.
REPLACEReplaces text by character position.=REPLACE("ABC-001",5,3,"245") returns ABC-245.
CONCATJoins text values without a delimiter.=CONCAT(A2,"-",B2) joins two cells.
CONCATENATELegacy compatible text joining function.=CONCATENATE(A2," ",B2).
TEXTJOINJoins a range with a delimiter and optional blank skipping.=TEXTJOIN(", ",TRUE,A2:A5).
TEXTFormats a number as text using a number format.=TEXT(1234.5,"$#,##0.00") returns $1,234.50.
VALUEConverts number-like text to a number using locale rules.=VALUE("125.5") returns 125.5.
NUMBERVALUEConverts text to a number with explicit decimal/group separators.=NUMBERVALUE("1.234,5",",",".") returns 1234.5.
EXACTCompares text with case sensitivity.=EXACT("Excel","EXCEL") returns FALSE.
REPTRepeats text a specified number of times.=REPT("0",3) returns 000.
CHAR / CODEConverts between numbers and characters in the current code page.=CHAR(65) returns A; =CODE("A") returns 65.
UNICHAR / UNICODEConverts Unicode code points and characters.=UNICHAR(9733) returns a star; =UNICODE("A") returns 65.
TEXTBEFORE / TEXTAFTERReturns text before or after a delimiter (Microsoft 365).=TEXTBEFORE("North-042","-") returns North.

Clean imported text: =TRIM(CLEAN(A2))

Split and rebuild a value

For older Excel, combine LEFT, MID, RIGHT, FIND, and LEN. In Microsoft 365, TEXTSPLIT can split a value across columns or rows; see Lesson 9 for dynamic-array formulas. Formatting numbers with TEXT creates text, so keep the original numeric value for calculations.

  1. Clean spaces and line breaks first.
  2. Find a delimiter rather than assuming a fixed position when source data varies.
  3. Check whether a result must remain numeric, especially dates and amounts.

Progress stays in this browser.