Excel functions
Text functions
Text functions work on words, codes and labels. Use them to clean imported data (TRIM, CLEAN, SUBSTITUTE), take pieces out of a string (LEFT, MID, TEXTBEFORE, REGEXEXTRACT), join lists (TEXTJOIN, CONCAT) and turn numbers and dates into nicely formatted text (TEXT).
Start with these
CONCATJoins text from several cells, ranges or values into one string. Unlike CONCATENATE it accepts whole ranges like A2:D2.FINDReturns the position of one piece of text inside another, counting from the left. Case-sensitive and without wildcards.LEFTReturns a set number of characters from the start of a text string, e.g. the first 3 letters of a product code.LENCounts the characters in a text string, including spaces, punctuation and invisible characters.LOWERConverts all letters in a text string to lowercase. Numbers and punctuation are unchanged.MIDReturns a given number of characters from the middle of a text, starting at any position you choose.PROPERCapitalises the first letter of every word and makes all other letters lowercase, e.g. "aNA sILVA" becomes "Ana Silva".REGEXEXTRACTPulls text that matches a regular expression pattern out of a string: the first match, all matches, or the capture groups.REGEXREPLACEReplaces text that matches a regular expression with new text, with support for capture-group references like $1.REGEXTESTChecks whether text matches a regular expression pattern and returns TRUE or FALSE. Great for validating codes and emails.REPLACEReplaces part of a text string, chosen by position and length, with different text. Also used to insert or delete characters.RIGHTReturns a set number of characters from the end of a text string, e.g. the last 4 digits of a phone or account number.SEARCHReturns the position of one text inside another, ignoring case and allowing wildcards ( and ?).SUBSTITUTEReplaces every occurrence (or one chosen occurrence) of a specific text with new text. Case-sensitive.TEXTFormats a number or date as text using a format code such as "#,##0.00", "0%" or "dd-mmm-yyyy", e.g. for use in sentences and labels.TEXTAFTERReturns the text that comes after a delimiter, with options for the nth or last occurrence, case-insensitive matching and a not-found value.TEXTBEFOREReturns the text that comes before a delimiter, with options for the nth or last occurrence, case-insensitive matching and a fallback.TEXTJOINJoins text from ranges or values with a delimiter between each item, optionally skipping empty cells.TEXTSPLITSplits text into separate cells at the delimiters you choose, across columns, down rows, or both. The result spills.TRIMRemoves spaces at the start and end of text and reduces any run of spaces between words to a single space.UPPERConverts all letters in a text string to capitals. Digits and punctuation are unchanged.VALUEConverts text that looks like a number, percentage, date or time into a real number Excel can calculate with.
All 49 text functions
- ARRAYTOTEXTTurns a range or array into one line of text, either as a readable list or in strict array-constant form you can paste into a formula.
- ASCConverts full-width (double-byte) letters, digits and katakana to their half-width (single-byte) forms.
- BAHTTEXTWrites a number out in Thai words followed by Baht (and Satang for the decimals), as required on Thai cheques and invoices.
- CHARReturns the character that belongs to a code number from 1 to 255, such as CHAR(10) for a line break inside a cell.
- CLEANRemoves non-printing control characters (codes 0-31), such as line breaks and tabs, from text copied out of other systems.
- CODEReturns the numeric code of the first character in a text string, e.g. CODE("A") = 65. Useful for finding hidden characters.
- CONCATJoins text from several cells, ranges or values into one string. Unlike CONCATENATE it accepts whole ranges like A2:D2.
- CONCATENATEJoins up to 255 text items into one string. Kept for compatibility; CONCAT and TEXTJOIN are the modern alternatives.
- DBCSConverts half-width (single-byte) letters, digits and katakana to full-width (double-byte) characters. The opposite of ASC.
- DETECTLANGUAGEIdentifies the language of a piece of text and returns its language code, such as "en", "fr" or "de".
- DOLLARConverts a number to text in currency format, using your system's currency symbol, e.g. 1234.5 becomes "$1,234.50".
- EXACTCompares two text strings and returns TRUE only if they are identical, including upper and lower case.
- FINDReturns the position of one piece of text inside another, counting from the left. Case-sensitive and without wildcards.
- FINDBLike FIND, but returns the position in bytes: Japanese, Chinese and Korean characters count as 2 when a DBCS language is the default.
- FIXEDRounds a number to a set number of decimals and returns it as text, with or without thousands separators.
- LEFTReturns a set number of characters from the start of a text string, e.g. the first 3 letters of a product code.
- LEFTBReturns the first characters of a text up to a given number of bytes; double-byte characters count as 2 when a DBCS language is the default.
- LENCounts the characters in a text string, including spaces, punctuation and invisible characters.
- LENBCounts the bytes in a text string: 2 for each double-byte (CJK) character when a DBCS language is the default, otherwise the same as LEN.
- LOWERConverts all letters in a text string to lowercase. Numbers and punctuation are unchanged.
- MIDReturns a given number of characters from the middle of a text, starting at any position you choose.
- MIDBReturns characters from the middle of a text, with start and length measured in bytes (2 per CJK character when a DBCS language is the default).
- NUMBERVALUEConverts text to a number using the decimal and thousands separators you specify, so "1.234,56" can become 1234.56 on any PC.
- PHONETICReturns the furigana (phonetic reading in katakana or hiragana) stored with Japanese text in a cell.
- PROPERCapitalises the first letter of every word and makes all other letters lowercase, e.g. "aNA sILVA" becomes "Ana Silva".
- REGEXEXTRACTPulls text that matches a regular expression pattern out of a string: the first match, all matches, or the capture groups.
- REGEXREPLACEReplaces text that matches a regular expression with new text, with support for capture-group references like $1.
- REGEXTESTChecks whether text matches a regular expression pattern and returns TRUE or FALSE. Great for validating codes and emails.
- REPLACEReplaces part of a text string, chosen by position and length, with different text. Also used to insert or delete characters.
- REPLACEBReplaces part of a text by byte position and byte length, counting CJK characters as 2 bytes when a DBCS language is the default.
- REPTRepeats a text a given number of times. Used for in-cell bar charts, star ratings and padding values with zeros.
- RIGHTReturns a set number of characters from the end of a text string, e.g. the last 4 digits of a phone or account number.
- RIGHTBReturns the last characters of a text up to a given number of bytes; CJK characters count as 2 when a DBCS language is the default.
- SEARCHReturns the position of one text inside another, ignoring case and allowing wildcards ( and ?).
- SEARCHBLike SEARCH (case-insensitive, wildcards), but returns the position in bytes, counting CJK characters as 2 when a DBCS language is the default.
- SUBSTITUTEReplaces every occurrence (or one chosen occurrence) of a specific text with new text. Case-sensitive.
- TReturns the value if it is text, or an empty string if it is a number, date, logical value or anything else.
- TEXTFormats a number or date as text using a format code such as "#,##0.00", "0%" or "dd-mmm-yyyy", e.g. for use in sentences and labels.
- TEXTAFTERReturns the text that comes after a delimiter, with options for the nth or last occurrence, case-insensitive matching and a not-found value.
- TEXTBEFOREReturns the text that comes before a delimiter, with options for the nth or last occurrence, case-insensitive matching and a fallback.
- TEXTJOINJoins text from ranges or values with a delimiter between each item, optionally skipping empty cells.
- TEXTSPLITSplits text into separate cells at the delimiters you choose, across columns, down rows, or both. The result spills.
- TRANSLATETranslates text from one language to another using Microsoft's online translation service, e.g. English to Spanish.
- TRIMRemoves spaces at the start and end of text and reduces any run of spaces between words to a single space.
- UNICHARReturns the Unicode character for a code number, e.g. UNICHAR(8364) = €. Gives access to arrows, symbols and all alphabets.
- UNICODEReturns the Unicode code point of the first character of a text, e.g. UNICODE("€") = 8364.
- UPPERConverts all letters in a text string to capitals. Digits and punctuation are unchanged.
- VALUEConverts text that looks like a number, percentage, date or time into a real number Excel can calculate with.
- VALUETOTEXTConverts any value to text. In strict mode text is wrapped in quotes, so the output can be pasted into a formula.