Count mixed product codes with a formula that ignores non-numeric cells

Are you struggling to count cells in Excel that contain only numbers, particularly when dealing with product codes that may start with a zero?

3 min readMicrosoft Excel | Help & Support with your Formula, Macro, and VBA problems | A Reddit Community

This user's frustration is exactly the kind of friction that should not exist in modern data work. They have a simple goal, count only the cells that contain purely numeric product codes, and Excel is failing them because it treats `012345` as text while `A12345` is already text. The formula they tried, `=SUMPRODUCT(--ISNUMBER(range))`, is the standard approach, and it returns nothing useful because `ISNUMBER` quite literally returns `FALSE` on every cell. The problem is not the formula; the problem is that the spreadsheet cannot see the data the way the user does.

This is the moment where a legacy tool exposes its limits. Excel's cell-formatting logic treats a leading zero as a signal to store the value as text, because a number cannot begin with zero. That makes sense for a general-purpose calculator, but product codes are not numbers in any mathematical sense. They are identifiers that happen to use digits. The same issue appears with phone numbers, ZIP codes, and SKUs. The user is not asking for a calculation; they are asking for a data classification. And Excel's built-in functions are not designed to answer that question reliably when formatting has already corrupted the type.

What the user actually needs is a formula that inspects the content of each cell, not its underlying data type. A working approach would be to use `=SUMPRODUCT(--(ISTEXT(range)*ISNUMBER(--range)))` or a `COUNTIF` variant that checks for a pattern. Something like `=COUNTIF(range,"*[A-Za-z]*")` can flag cells with letters, but that only solves half the problem. The cleaner path is to treat every cell as text and then check whether every character in the cell is a digit. That is a job for `SUMPRODUCT` combined with a function that loops through each character, or for a helper column using `IF(SUMPRODUCT(--ISNUMBER(--MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)))=LEN(A1),1,0)`. It is not elegant, but it works because it ignores Excel's broken type detection and looks at the actual string.

The deeper lesson here is that spreadsheets were built for accountants, not for data analysts. When your workflow involves product codes, timestamps, or any identifier that mixes digits and letters, the spreadsheet's assumptions about what a "number" is become a liability. Users should not have to write a twelve-line nested formula just to ask "does this cell contain only digits?" That question should be a single, obvious function. The fact that it is not is a sign that the tool has not evolved to match the way people actually use data today. If you are feeling this pain, it is not because you are doing something wrong. It is because the tool is doing something wrong for you.

From Microsoft Excel | Help & Support with your Formula, Macro, and VBA problems | A Reddit Community

Trying to build a formula that will count the number of cells that contain only numbers and no letters. My issue is excel doesn't seem to recognize the cells as numbers & fornatting may mess them up because they're product codes and some start with 0. so some cells are like 0123456 and some are like A12345 and I want a formula to auto count the cells without the A.

Doesn't work: =SUMPRODUCT(--ISNUMBER(range))

Read the original at Microsoft Excel | Help & Support with your Formula, Macro, and VBA problems | A Reddit Community