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.
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.
(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:
Recommended Productivity Tools
Bring handy tabs to Excel and other Office software, just like Chrome, Firefox and new Internet Explorer.
Amazing! Increase your productivity in 5 minutes. Don't need any special skills, save two hours every day!
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...