Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

How to Count Symbols in Excel: LEN and SUBSTITUTE

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

You can count symbols in Excel by combining the LEN and SUBSTITUTE functions: subtract the length of the text with the symbol removed from the length of the original text. For example, =LEN(A2)-LEN(SUBSTITUTE(A2,"@","")) returns the number of @ symbols in cell A2. This works for any single character, including punctuation, spaces, and special symbols, and it counts every occurrence, not just whether the symbol exists. For a whole range, fill the formula down or wrap it in SUMPRODUCT. The rest of this guide covers the exact formulas, how to count several different symbols at once, and the mistakes that produce wrong totals.

What You'll Need

  • Excel for Windows, Mac, or the web version (the functions used here are identical across all three).
  • Your text in a column, ideally one value per cell, with a header row so you can label the result.
  • No add-ins or macros are required; everything uses built-in functions.

Step-by-Step

  1. Put your text in a clean column. Enter or paste the text you want to analyse into column A, starting at A2 so row 1 stays free for headers. If the text is scattered, copy it into one column first; formulas work per cell, so a single value per cell gives the cleanest results.
  2. Pick a cell for the result. Click B2 (or any empty cell beside the first text value). This is where the count will appear.
  3. Enter the core formula. Type =LEN(A2)-LEN(SUBSTITUTE(A2,"@","")) and press Enter. Replace the @ with the symbol you want to count. LEN(A2) gives the total number of characters; SUBSTITUTE removes every @ from a copy of the text; the second LEN measures that shortened copy; the difference is the number of @ symbols.
  4. Check the result against a short example. If A2 contains a@b@c, the formula returns 2. If it contains abc, it returns 0. This quick sanity check catches a wrong symbol before you fill the formula down.
  5. Fill the formula down the column. Select B2, grab the fill handle (the small square at the bottom-right corner of the cell), and drag down to the last row of text. Alternatively, double-click the fill handle and Excel fills to the end of the adjacent data automatically.
  6. Total the column. In a cell below the results, enter =SUM(B2:B100) (adjust the range to your last row) to get the grand total of that symbol across all text.
  7. Count a different symbol by editing the formula. Change the @ inside the quotes to the character you need: #, -, /, ., a space, or a letter. Keep the quotation marks; they tell Excel the symbol is text, not a cell reference or operator.
  8. Count several symbols in separate columns. Put one formula per symbol in columns B, C, D, and so on, each with its own character in the quotes. Label the headers (for example "At signs", "Hyphens") so the output is readable.
  9. Count all symbols combined in one cell. If you want a single total for a set of characters, nest SUBSTITUTE calls: =LEN(A2)-LEN(SUBSTITUTE(SUBSTITUTE(A2,"@",""),"#","")) counts @ and # together. Add one more SUBSTITUTE layer for each extra symbol.
  10. Count across a whole range without a helper column. Use =SUMPRODUCT(LEN(A2:A100)-LEN(SUBSTITUTE(A2:A100,"@",""))). SUMPRODUCT handles the array of lengths in one step, so you get the total without filling anything down. Press Enter normally; modern Excel handles the array internally.
  11. Format and verify. Set the result cells to a plain number format (Home > Number) so they do not inherit text formatting. Spot-check two or three rows by counting the symbol manually in the formula bar to confirm the totals match.

Common Mistakes

  • Forgetting the quotation marks. Writing SUBSTITUTE(A2,@,"") makes Excel look for a named range called @ and return an error. The symbol must always be in quotes.
  • Counting a multi-character string by mistake. The formula counts occurrences of the exact text inside the quotes. If you type two characters, it counts that pair, not each character separately, which usually gives a lower number than expected.
  • Mixing up the two LEN arguments. The first LEN must reference the original cell and the second must wrap the SUBSTITUTE. Reversing them produces a negative number or zero.
  • Leaving the range unfilled. Dragging the formula without locking references is fine here because each row should shift, but copying the SUMPRODUCT version down without absolute references ($A$2:$A$100) shifts the range and double-counts.
  • Assuming case matters. SUBSTITUTE is case-sensitive, so counting "a" will not count "A". If you need both, use SUBSTITUTE(SUBSTITUTE(A2,"a",""),"A","") or convert the text with LOWER first.
  • Expecting the formula to see hidden characters. Line breaks, non-breaking spaces, and other invisible characters are counted as symbols too. If the total looks too high, check for them with CODE or CLEAN.

Tips

  • Use a named cell for the symbol instead of hard-coding it: put the character in, say, E1 and write SUBSTITUTE(A2,$E$1,""). Change E1 and every count updates.
  • To count spaces, put a single space between the quotes: SUBSTITUTE(A2," ",""). This is useful for word counts, where words equal spaces plus one.
  • To count a symbol only in a specific position, combine LEFT, MID, or RIGHT with the same LEN-SUBSTITUTE logic on the extracted substring.
  • For a quick visual check, use Find and Replace (Ctrl+H) with the symbol in "Find what" and an empty "Replace with". The dialog reports how many replacements it would make before you confirm; click Cancel to leave the text unchanged.
  • Keep a helper column rather than overwriting your source text. Deleting or editing the original cells changes every dependent count.

Troubleshooting

  • The formula returns #VALUE!. A quote is missing or the symbol was typed without quotes. Recheck the syntax and make sure the character sits inside straight double quotes, not curly ones pasted from a document.
  • The count is zero but you can see the symbol. The symbol may be a different character than it looks (for example a curly apostrophe versus a straight one, or a non-breaking space). Copy the actual character from the cell and paste it into the formula.
  • The total is higher than expected. Hidden characters such as line breaks are being counted. Wrap the text in CLEAN first: LEN(A2)-LEN(SUBSTITUTE(CLEAN(A2),"@","")).
  • The formula shows as text instead of calculating. The cell is formatted as Text. Change the format to General, then re-enter the formula by pressing F2 and Enter.
  • SUMPRODUCT gives an error. The ranges inside the two LEN functions must be the same size. Check that both point to A2:A100 and not one to A2:A100 and the other to A2:A99.
  • Results do not update after editing the text. Calculation may be set to Manual. Go to Formulas > Calculation Options and choose Automatic.

Frequently Asked Questions

Can Excel count a specific symbol in a cell?

Yes. The LEN and SUBSTITUTE combination counts every occurrence of any single character you specify, including punctuation and special symbols.

Does the formula count uppercase and lowercase separately?

Yes. SUBSTITUTE is case-sensitive, so "a" and "A" are counted as different symbols unless you convert the text to one case first.

Can I count symbols across multiple cells at once?

Yes. SUMPRODUCT with LEN and SUBSTITUTE totals a symbol across a whole range in a single formula, with no helper column needed.

How do I count more than one symbol in the same formula?

Nest SUBSTITUTE calls, one per symbol, inside the inner LEN. Each layer removes another character before the length is measured.

Why does my count include characters I cannot see?

Invisible characters such as line breaks and non-breaking spaces are real characters. Use CLEAN or TRIM on the text before counting to remove them.

Does this work in Excel for the web and on Mac?

Yes. LEN, SUBSTITUTE, and SUMPRODUCT behave the same in Excel for Windows, Mac, and the web version.