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


How to count strings with leading zeros in Excel?

For instance, here are some strings with a different number of leading zeros. Generally speaking, using COUNTIF function will count the strings without leading zeros, but here, I want to count the same data with leading zeros as below screenshot shown.
doc count string with leading zero 1

Count strings with leading zeros

Count strings with leading zeros

To count a number of strings with leading zeros, you can use these formulas.

Select a cell next to the values, and the type this formula =SUMPRODUCT(--($A$2:$A$10=A2)), press Enter key, and drag fill handle down to fill the formulas.
doc count string with leading zero 2


(1) The formula =SUM(IF($A$2:$A$10=A2,1,0)) also can count strings with leading zeros, but need to press Shift + Ctrl + Enter keys.

(2) If you want to remove leading zeros from strings, you can apply the Remove Leading Zeros feature of Kutools for Excel. It’s full function without limitation in 60 days, please download and have a free trial now. See screenshots:
doc count string with leading zero 3

doc count string with leading zero 4 doc arrow right doc count string with leading zero 5


Recommended Productivity Tools

Office Tab

gold star1 Bring handy tabs to Excel and other Office software, just like Chrome, Firefox and new Internet Explorer.

Kutools for Excel

gold star1 Amazing! Increase your productivity in 5 minutes. Don't need any special skills, save two hours every day!

gold star1 300 New Features for Excel, Make Excel Much Easy and Powerful:

  • Merge Cell/Rows/Columns without Losing Data.
  • Combine and Consolidate Multiple Sheets and Workbooks.
  • Compare Ranges, Copy Multiple Ranges, Convert Text to Date, Unit and Currency Conversion.
  • Count by Colors, Paging Subtotals, Advanced Sort and Super Filter,
  • More Select/Insert/Delete/Text/Format/Link/Comment/Workbooks/Worksheets Tools...

Screen shot of Kutools for Excel

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.