Excel formula library

Excel Tutorial

Every Excel formula in one place — search, filter by category or level, then open syntax, samples, and pitfalls. New formulas added to the library appear here automatically.

127 Formulas
11 Categories
3 Skill levels
Live Search & filters

Formula list

Find any Excel formula

Filter by category — Math, Lookup, FILTER and other Dynamic Arrays, Text, Date, and more — then open a formula for syntax and examples.

Chapter 6

Text & Strings

  1. 64 CONCAT =CONCAT(text1, [text2], ...) Combines text from multiple ranges and/or strings. Replaces CONCATENATE and allows passing entire multi-cell ranges directly. Text & Strings Beginner Classic

    Syntax

    =CONCAT(text1, [text2], ...)

    Arguments

    text1
    Text item, range of cells, or string to join.

    Sample

    =CONCAT(A2, " ", B2)

    Result Rohan Sharma

    Sample data

    Download
    ABCD
    2RohanSharmaHRRohan Sharma
    3KabirVermaITKabir Verma
    4MeenaGuptaSalesMeena Gupta
    Pro tip

    Unlike CONCATENATE, CONCAT accepts full ranges like =CONCAT(A2:D2).

    Common pitfall

    CONCAT does not provide a delimiter option between cells; use TEXTJOIN if you need commas or spaces between items.

  2. 65 CONCATENATE =CONCATENATE(text1, [text2], ...) Classic function to join two or more text strings into one. Still supported for backwards compatibility across legacy workbooks. Text & Strings Beginner Classic

    Syntax

    =CONCATENATE(text1, [text2], ...)

    Arguments

    text1, text2
    Up to 255 text items to be joined.

    Sample

    =CONCATENATE(A2, " ", B2)

    Result Rohan Sharma

    Sample data

    Download
    ABCD
    2RohanSharmaRohan Sharma=A2 & " " & B2
    3KabirVermaKabir Verma=A3 & " " & B3
    4MeenaGuptaMeena Gupta=A4 & " " & B4
    Pro tip

    You can achieve the same result faster using the ampersand & operator: =A2 & " " & B2.

    Common pitfall

    Does NOT accept array ranges like A1:A5 (returns only the first cell or #VALUE!).

  3. 66 TEXTJOIN =TEXTJOIN(delimiter, ignore_empty, text1, [text2], ...) Combines text from multiple ranges and/or strings, using a specified delimiter, and optionally ignoring empty cells. Text & Strings Intermediate Classic

    Syntax

    =TEXTJOIN(delimiter, ignore_empty, text1, [text2], ...)

    Arguments

    delimiter
    Text string (like comma, space, or hyphen) inserted between each text item.
    ignore_empty
    If TRUE, empty cells are skipped; if FALSE, delimiter is still inserted.
    text1, [text2, ...]
    The strings or multi-cell ranges to join.

    Sample

    =TEXTJOIN(", ", TRUE, A2:D2)

    Result Rohan Sharma, HR, 350, Delhi

    Sample data

    Download
    ABCD
    2Rohan SharmaHR350Delhi
    3Kabir VermaIT400Mumbai
    4Meena GuptaSales450Pune
    Pro tip

    Join an entire vertical column into a single cell in one shot: =TEXTJOIN(", ", TRUE, A2:A50).

    Common pitfall

    If the resulting text exceeds 32,767 characters (Excel single-cell limit), TEXTJOIN returns #VALUE!.

  4. 67 LEFT =LEFT(text, [num_chars]) Returns the first character or characters in a text string, based on the number of characters you specify. Text & Strings Beginner Classic

    Syntax

    =LEFT(text, [num_chars])

    Arguments

    text
    The text string that contains the characters you want to extract.
    [num_chars]
    Specifies the number of characters you want LEFT to extract. Default is 1.

    Sample

    =LEFT(A2, 5)

    Result Rohan

    Sample data

    Download
    ABCD
    2Rohan SharmaE-101RohanFirst 5 letters
    3Kabir VermaE-102KabirFirst 5 letters
    4Meena GuptaE-103MeenaFirst 5 letters
    Pro tip

    Extract first name dynamically regardless of length: =LEFT(A2, FIND(" ", A2) - 1).

    Common pitfall

    Num_chars must be greater than or equal to 0; negative numbers return #VALUE!.

  5. 68 RIGHT =RIGHT(text, [num_chars]) Returns the last character or characters in a text string, based on the number of characters you specify. Text & Strings Beginner Classic

    Syntax

    =RIGHT(text, [num_chars])

    Arguments

    text
    The text string containing characters to extract.
    [num_chars]
    The number of characters to extract from the right. Default is 1.

    Sample

    =RIGHT(A2, 4)

    Result 4321

    Sample data

    Download
    ABCD
    2XXXX-XXXX-XXXX-4321Rohan Sharma4321Ending digits
    3XXXX-XXXX-XXXX-8765Kabir Verma8765Ending digits
    4XXXX-XXXX-XXXX-1122Meena Gupta1122Ending digits
    Pro tip

    To extract dynamic last name: =RIGHT(A2, LEN(A2) - FIND(" ", A2)).

    Common pitfall

    Numbers returned by RIGHT are formatted as text strings. Wrap in VALUE() if you need to calculate with them.

  6. 69 MID =MID(text, start_num, num_chars) Returns a specific number of characters from a text string, starting at the position you specify, based on the number of characters you specify. Text & Strings Intermediate Classic

    Syntax

    =MID(text, start_num, num_chars)

    Arguments

    text
    The text string containing the characters you want to extract.
    start_num
    The position of the first character you want to extract (1-based).
    num_chars
    The number of characters to return from the start position.

    Sample

    =MID(A2, 7, 6)

    Result Sharma

    Sample data

    Download
    ABCD
    2Rohan SharmaEMP-01SharmaChars from pos 7
    3Kabir VermaEMP-02VermaChars from pos 7
    4Meena GuptaEMP-03GuptaChars from pos 7
    Pro tip

    If num_chars exceeds the remaining length of the string, MID simply returns all remaining characters without error.

    Common pitfall

    Start_num must be >= 1. If start_num is greater than string length, MID returns empty string "".

  7. 70 LEN =LEN(text) Returns the number of characters in a text string. Counts letters, numbers, punctuation, spaces, and invisible characters. Text & Strings Beginner Classic

    Syntax

    =LEN(text)

    Arguments

    text
    The text whose length you want to measure.

    Sample

    =LEN(A2)

    Result 12

    Sample data

    Download
    ABCD
    2Rohan Sharma1211 letters + 1 spaceValid (
    Pro tip

    Count occurrences of a specific letter (e.g. "a") in cell A1: =LEN(A1) - LEN(SUBSTITUTE(LOWER(A1), "a", "")).

    Common pitfall

    Spaces count toward LEN! Trailing spaces often cause passwords or lookup matches to fail unexpectedly.

  8. 71 TRIM =TRIM(text) Removes all spaces from text except for single spaces between words. Perfect for cleaning messy data exports. Text & Strings Beginner Classic

    Syntax

    =TRIM(text)

    Arguments

    text
    The text from which you want spaces removed.

    Sample

    =TRIM(A2)

    Result Rohan Sharma

    Sample data

    Download
    ABCD
    2Rohan Sharma18Rohan Sharma12 (Extra 6 removed)
    3Kabir Verma13Kabir Verma11 (Cleaned)
    4Meena Gupta14Meena Gupta11 (Cleaned)
    Pro tip

    TRIM only removes standard ASCII space 32. For stubborn non-breaking web spaces (ASCII 160), use =TRIM(CLEAN(SUBSTITUTE(A1, CHAR(160), " "))).

    Common pitfall

    TRIM preserves single spaces between words; it only removes extra duplicates and leading/trailing ones.

  9. 72 UPPER =UPPER(text) Converts text to uppercase. Useful for standardizing code keys, state abbreviations, and passport numbers. Text & Strings Beginner Classic

    Syntax

    =UPPER(text)

    Arguments

    text
    The text you want converted to uppercase.

    Sample

    =UPPER(A2)

    Result ROHAN SHARMA

    Sample data

    Download
    ABCD
    2Rohan SharmaROHAN SHARMAEMP-RSFormatted
    3kabir vermaKABIR VERMAEMP-KVFormatted
    4Meena GUPTAMEENA GUPTAEMP-MGFormatted
    Pro tip

    Numbers and punctuation marks in the text are completely unaffected by UPPER.

    Common pitfall

    Cannot modify text in-place directly; you must output to a helper column, then copy and paste-as-values.

  10. 73 LOWER =LOWER(text) Converts all letters in a text string to lowercase. Essential for normalizing customer emails and web domains. Text & Strings Beginner Classic

    Syntax

    =LOWER(text)

    Arguments

    text
    The text you want converted to lowercase.

    Sample

    =LOWER(A2)

    Result rohan.sharma@corp.com

    Sample data

    Download
    ABCD
    2Rohan.SHARMA@Corp.comrohan.sharma@corp.comYesActive
    3KABIR.VERMA@CORP.COMkabir.verma@corp.comYesActive
    4Meena.Gupta@CORP.COMmeena.gupta@corp.comYesActive
    Pro tip

    Essential preliminary step before running EXACT comparisons if you want case-insensitivity.

    Common pitfall

    Does not strip spaces; combine with TRIM if needed: =LOWER(TRIM(A2)).

  11. 74 PROPER =PROPER(text) Capitalizes the first letter in a text string and any other letters in text that follow any character other than a letter. Converts all other letters to lowercase. Text & Strings Beginner Classic

    Syntax

    =PROPER(text)

    Arguments

    text
    Text enclosed in quotation marks, a formula that returns text, or a cell reference.

    Sample

    =PROPER(A2)

    Result Rohan Sharma

    Sample data

    Download
    ABCD
    2rohan sharmaRohan Sharmadelhi ? DelhiStandard Title
    3KABIR VERMAKabir Vermamumbai ? MumbaiStandard Title
    4mEeNa GuPtAMeena Guptapune ? PuneStandard Title
    Pro tip

    PROPER treats any letter after a non-letter (like an apostrophe or hyphen) as a new word (e.g. "o'connor" becomes "O'Connor").

    Common pitfall

    Acronyms like "USA" or "NASA" will be converted to "Usa" and "Nasa" by PROPER.

  12. 75 REPLACE =REPLACE(old_text, start_num, num_chars, new_text) Replaces part of a text string, based on the number of characters and position you specify, with a new text string. Text & Strings Intermediate Classic

    Syntax

    =REPLACE(old_text, start_num, num_chars, new_text)

    Arguments

    old_text
    Text in which you want to replace some characters.
    start_num
    The position of the character in old_text that you want to replace.
    num_chars
    The number of characters in old_text that you want REPLACE to replace.
    new_text
    The text that will replace characters in old_text.

    Sample

    =REPLACE(A2, 1, 3, "USR")

    Result USR-101

    Sample data

    Download
    ABCD
    2EMP-101HRUSR-101Replaced "EMP" with "USR"
    3EMP-102ITUSR-102Replaced "EMP" with "USR"
    4EMP-103SalesUSR-103Replaced "EMP" with "USR"
    Pro tip

    Set num_chars to 0 to INSERT text at a specific position without deleting existing characters!

    Common pitfall

    REPLACE is strictly position-based; if you want to replace specific text regardless of where it appears, use SUBSTITUTE.

  13. 76 SUBSTITUTE =SUBSTITUTE(text, old_text, new_text, [instance_num]) Substitutes new_text for old_text in a text string. Use when you want to replace specific text rather than a fixed position. Text & Strings Intermediate Classic

    Syntax

    =SUBSTITUTE(text, old_text, new_text, [instance_num])

    Arguments

    text
    The text or the reference to a cell containing text for which you want to substitute characters.
    old_text
    The text you want to replace.
    new_text
    The replacement string.
    [instance_num]
    Specifies which occurrence of old_text you want to replace. If omitted, every occurrence is replaced.

    Sample

    =SUBSTITUTE(A2, "Sharma", "Kumar")

    Result Rohan Kumar

    Sample data

    Download
    ABCD
    2Rohan SharmaSharma ? KumarRohan KumarReplaced text
    3Amit SharmaSharma ? KumarAmit KumarReplaced text
    4Kabir VermaVerma ? SinghKabir SinghReplaced text
    Pro tip

    SUBSTITUTE is case-sensitive ("sharma" will not match "Sharma").

    Common pitfall

    If old_text does not match the exact letter case, SUBSTITUTE silently returns the original text unchanged.

  14. 77 TEXT =TEXT(value, format_text) Converts a numeric or date value to formatted text according to a specified format string. Text & Strings Intermediate Classic

    Syntax

    =TEXT(value, format_text)

    Arguments

    value
    A numeric value, a formula that evaluates to a numeric value, or a cell reference.
    format_text
    A custom format code enclosed in quotes (e.g. "dd-mmm-yyyy", "$#,##0.00", "0.0%").

    Sample

    =TEXT(A2, "dd-mmm-yyyy")

    Result 45757

    Sample data

    Download
    ABCD
    24575710-Apr-2025Thursday (=TEXT(A2,"dddd"))Q2-2025
    34565801-Jan-2025WednesdayQ1-2025
    44588415-Aug-2025FridayQ3-2025
    Pro tip

    Use format "dddd" for full weekday name ("Thursday") or "mmmm" for full month name ("April").

    Common pitfall

    The result is TEXT, not a number or date! You cannot perform mathematical sums directly on the output of TEXT.

  15. 78 VALUE =VALUE(text) Converts a text string that represents a number to a number. Enables math on text-formatted imported data. Text & Strings Beginner Classic

    Syntax

    =VALUE(text)

    Arguments

    text
    The text enclosed in quotation marks or a reference to a cell containing text to convert.

    Sample

    =VALUE(A2)

    Result 1000

    Sample data

    Download
    ABCD
    2"1000"String Text1,000Yes (Ready for SUM)
    3"$450.50"String Text450.50Yes
    4" 85 "String Text85Yes
    Pro tip

    A fast shortcut to convert text to number is adding zero: =A2 + 0 or double unary --A2.

    Common pitfall

    If text contains non-numeric characters that cannot be parsed into a number, VALUE returns #VALUE!.

  16. 79 NUMBERVALUE =NUMBERVALUE(text, [decimal_separator], [group_separator]) Converts text to a number in a locale-independent way. Crucial when working with European comma decimals. Text & Strings Intermediate Classic

    Syntax

    =NUMBERVALUE(text, [decimal_separator], [group_separator])

    Arguments

    text
    The text to convert to a number.
    [decimal_separator]
    The character used to separate the integer and fraction of the result.
    [group_separator]
    The character used to separate thousands groupings.

    Sample

    =NUMBERVALUE("1.250,50", ",", ".")

    Result 1250.5

    Sample data

    Download
    ABCD
    2"1.250,50"Comma (,)1250.501,250.50
    3"450,75"Comma (,)450.75450.75
    4"10 000,00"Space ( )10000.0010,000.00
    Pro tip

    NUMBERVALUE automatically handles trailing percentage signs like "15%".

    Common pitfall

    Decimal separator and group separator must be different characters; using the same character returns #VALUE!.

  17. 80 DOLLAR =DOLLAR(number, [decimals]) Converts a number to text using currency format, with decimals rounded to the specified place. Text & Strings Beginner Classic

    Syntax

    =DOLLAR(number, [decimals])

    Arguments

    number
    A number, a reference to a cell containing a number, or a formula that evaluates to a number.
    [decimals]
    The number of digits to the right of the decimal point. Default is 2.

    Sample

    =DOLLAR(B2, 2)

    Result $1,250.00

    Sample data

    Download
    ABCD
    2Server License1250$1,250.00Currency Text
    3Cloud Storage45.8$45.80Currency Text
    4Domain Name12.99$12.99Currency Text
    Common pitfall

    The return value is a text string. You cannot use SUM or AVERAGE on the output of DOLLAR().

  18. 81 FIND =FIND(find_text, within_text, [start_num]) Locates one text string within a second text string, and returns the number of the starting position. FIND is case-sensitive and does not support wildcards. Text & Strings Intermediate Classic

    Syntax

    =FIND(find_text, within_text, [start_num])

    Arguments

    find_text
    The text you want to find.
    within_text
    The text containing the text you want to find.
    [start_num]
    Specifies character at which to start search (default is 1).

    Sample

    =FIND("Sharma", A2)

    Result 7

    Sample data

    Download
    ABCD
    2Rohan Sharma7Exact Case MatchFound at char 7
    3Kabir Verma#VALUE!Not FoundSharma not present
    4Amit Sharma6Exact Case MatchFound at char 6
    Pro tip

    If you want case-insensitive search, use SEARCH instead of FIND.

    Common pitfall

    If find_text is not found, FIND returns a #VALUE! error. Wrap in IFERROR to handle gracefully.

  19. 82 SEARCH =SEARCH(find_text, within_text, [start_num]) Locates one text string within a second text string, and returns the number of the starting position. Case-insensitive and supports * and ? wildcards. Text & Strings Intermediate Classic

    Syntax

    =SEARCH(find_text, within_text, [start_num])

    Arguments

    find_text
    The text you want to find (wildcards allowed).
    within_text
    The text in which you want to search.

    Sample

    =SEARCH("sharma", A2)

    Result 7

    Sample data

    Download
    ABCD
    2Rohan Sharma7Found uppercase SPosition 7
    3Rohan sharma7Found lowercase sPosition 7
    4ROHAN SHARMA7Found all-capsPosition 7
    Pro tip

    Test if a cell contains a word: =ISNUMBER(SEARCH("apple", A2)).

    Common pitfall

    If you need exact case matching, use FIND instead of SEARCH.

  20. 83 EXACT =EXACT(text1, text2) Compares two text strings and returns TRUE if they are exactly identical, including case sensitivity, and FALSE otherwise. Text & Strings Beginner Classic

    Syntax

    =EXACT(text1, text2)

    Arguments

    text1, text2
    The two text strings you want to compare.

    Sample

    =EXACT(A2, B2)

    Result FALSE

    Sample data

    Download
    ABCD
    2SharmaSHARMAFALSE (Case mismatch)TRUE (Case insensitive)
    3SharmaSharmaTRUE (Exact match)TRUE
    4VermaVermaFALSE (Trailing space)FALSE
    Pro tip

    Standard Excel = comparison is case-insensitive ("a" = "A" is TRUE). Use EXACT when case matters.

    Common pitfall

    EXACT checks spaces too; an invisible trailing space will cause EXACT to return FALSE.

  21. 84 CLEAN =CLEAN(text) Removes all nonprintable characters from text (ASCII 0 through 31). Strips unwanted line breaks and system control characters. Text & Strings Beginner Classic

    Syntax

    =CLEAN(text)

    Arguments

    text
    Any worksheet information from which you want to remove nonprintable characters.

    Sample

    =CLEAN(A2)

    Result Cleaned String

    Sample data

    Download
    ABCD
    2Line 1 Line 2Line 1 Line 2ASCII 10 (Linefeed)Sanitized
    3Raw Tabbed DataRawTabbedDataASCII 9 (Tab)Sanitized
    4System FeedSystem FeedASCII 13 (CR)Sanitized
    Pro tip

    Often combined with TRIM for total data sanitation: =TRIM(CLEAN(A2)).

    Common pitfall

    CLEAN only removes ASCII 0-31. It does NOT remove non-breaking web spaces (ASCII 160).

  22. 85 CHAR =CHAR(number) Returns the character specified by a number. Use CHAR to translate code page numbers into characters (e.g. CHAR(10) for line break). Text & Strings Intermediate Classic

    Syntax

    =CHAR(number)

    Arguments

    number
    A number between 1 and 255 specifying the character you want.

    Sample

    =CHAR(A2)

    Result A

    Sample data

    Download
    ABCD
    265ACapital letter ALetter generation
    366BCapital letter BLetter generation
    410LineBreakLine Feed (Wrap text)Multi-line formulas
    Pro tip

    To make CHAR(10) show as a line break, enable "Wrap Text" on the cell formatting.

    Common pitfall

    Numbers outside the 1 to 255 range return a #VALUE! error.

  23. 86 UNICHAR =UNICHAR(number) Returns the Unicode character that is referenced by the given numeric value, including modern symbols, tick marks, and emojis. Text & Strings Intermediate Classic

    Syntax

    =UNICHAR(number)

    Arguments

    number
    The Unicode number that represents the character.

    Sample

    =UNICHAR(A2)

    Result ?

    Sample data

    Download
    ABCD
    210004?Green CheckmarkTarget Met
    310008?Cross MarkTarget Missed
    49733?Solid StarRating Scale
    Pro tip

    Use UNICHAR(9650) for green up-arrow ? and UNICHAR(9660) for red down-arrow ? in financial dashboards.

    Common pitfall

    If number is 0 or outside Unicode range, UNICHAR returns #VALUE!.

  24. 87 UNICODE =UNICODE(text) Returns the number (code point) corresponding to the first character of the text. Text & Strings Intermediate Classic

    Syntax

    =UNICODE(text)

    Arguments

    text
    The character or string for which you want the Unicode value.

    Sample

    =UNICODE(A2)

    Result 65

    Sample data

    Download
    ABCD
    2A65U+0041Basic Latin
    3?10004U+2714Dingbats Symbol
    4?9733U+2605Star Symbol
    Pro tip

    UNICODE only evaluates the first character of the input string.

    Common pitfall

    Empty text "" returns #VALUE!.

  25. 88 REPT =REPT(text, number_times) Repeats text a given number of times. Classic technique for building lightweight in-cell bar charts and star ratings. Text & Strings Beginner Classic

    Syntax

    =REPT(text, number_times)

    Arguments

    text
    The text you want to repeat.
    number_times
    A positive number specifying the number of times to repeat text.

    Sample

    =REPT("?", B2)

    Result ?????

    Sample data

    Download
    ABCD
    2Laptop Pro5?????Top Rated
    3Wireless Mouse4????High Rating
    4USB-C Hub3???Average
    Pro tip

    Format the in-cell chart formula =REPT("|", A2) with the font "Playbill" or "Stencil" to create solid bar charts!

    Common pitfall

    If number_times is 0, REPT returns empty text "". If negative, returns #VALUE!.