How to count the number of spaces before text string in Excel cell?
Sometimes, when you received a workbook from others, there may be some spaces before strings in the cells. Have you ever imaged to count the number of these leading spaces? Here, I introduce a formula to quickly count the number of leading spaces in cell.
To count spaces before text string, you just need to apply a formula.
Select a cell which you will place the calculated result at, and type this formula =FIND(LEFT(TRIM(A1),1),A1)-1, and press Enter. If you need, drag fill handle over the cell as you need.
Tip. If you want to remove leading zeros from cells, you can apply Kutools for Excel's Remove Spaces utility to quickly remove the leading zeros, also, it can remove trailing spaces, excess space and all spaces. It’s full function without limitation in 60 days, please download and have a free trial now.