Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to count the number of spaces of text string in Excel?

Have you ever tried to count the number of spaces of text string in a cell? Of course, you can count them one by one manually, but, if there are multiple cells needed to be counted, this way will be tedious and time consuming. Today, I can talk about some formulas for dealing with this problem in Excel.

Count the number of all spaces of text string with formula

Count the number of all spaces of text string with Kutools for Excel

Count the number of leading spaces of text string with formula


Count the number of spaces or other special characters:

Kutools for Excel’s Countchar function can help you quickly count the number of specific character appears in a cell.

doc-count-spaces-8 8

Kutools for Excel: with more than 200 handy Excel add-ins, free to try with no limitation in 60 days. Download and free trial Now!



To get the number of all spaces among the text string, the following formula can help you, please do as this:

1. Enter this formula: =LEN(A2)-LEN(SUBSTITUTE(A2," ",""))(A2 contains the text string that you want to count the spaces) into a blank cell, see screenshot:

doc-count-spaces-1

And then drag the fill handle over to the cells which you want to apply this formula, and all the spaces of a cell have been counted as follows:

doc-count-spaces-2


arrow blue right bubble Count the number of all spaces of text string with Kutools for Excel

If you have Kutools for Excel, its COUNTCHAR function of Kutools Functions may help you quickly count the number of times a specific character (such as a specific letter, comma, space and so on) appears within a cell.

Kutools for Excel : with more than 300 handy Excel add-ins, free to try with no limitation in 60 days.

After installing Kutools for Excel, please do as follows:

1. Click a cell where you want to put the result, B2, for example.

2. Then click Kutools > Kutools Function > Statistical & Math > COUNTCHAR, see screenshot:

doc-count-spaces-5 5

3. In the Function Arguments dialog box, click  111 button from the Within_text to select the cell that you want to get the number of the spaces, and then type the space bar once in the Find_text box, see screenshot:

doc-count-spaces-6

4. Then click OK button, you will get the number of spaces in the text string, and then drag the fill handle down to the cells which you want to apply this formula, all the spaces among the text strings have been counted at once. See screenshot:

doc-count-spaces-7

Click to know more about this COUNTCHAR function.

Free Download Kutools for Excel Now


arrow blue right bubble Demo: Count the number of all spaces of text string with Kutools for Excel

Kutools for Excel: with more than 200 handy Excel add-ins, free to try with no limitation in 60 days. Download and free trial Now!


The above formula can help you to count all spaces among the text string, but, if you just need to count the leading spaces of text string, I can introduce you another formula.

1. Please type this formula: =FIND(LEFT(TRIM(A2),1),A2)-1 (A2 contains the text string that you want to count the spaces) into a blank cell, see screenshot:

doc-count-spaces-3

2. Then drag the fill handle over to the range that you want to contain this formula, and then all the leading spaces before the text string have been counted, see screenshot:

doc-count-spaces-4


Related articles:

How to count the number of times a character /word appears in a cell?

How to countif with multiple criteria in Excel?

How to use countif to calculate the percentage in Excel?

How to countif a specific value across multiple worksheet?


Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

  • Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial.
kte tab 201905

Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
officetab bottom
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.

Be the first to comment.