Forum Discussion

PiotrL1750's avatar
PiotrL1750
Copper Contributor
Aug 30, 2023
Solved

COUNTIF cannot distinguish 26 digit number stored as text

Hello, I am trying to make simple list that will count number of repetitions of string in second list (Count how many times equipment with specific serial number was used). The specific strin...
  • HansVogelaar's avatar
    Aug 30, 2023

    PiotrL1750 

    When you enter a number with many digits, Excel interprets only the first 15 of them and replaces the rest with zeros.

    So you must enter the values as text, either by formatting the cells as Text before entering any values, or by prefixing the values with an apostrophe '.

    Also, COUNTIF tries to treat anything that looks like a number as a number, even if it is formatted as text, so it is not suitable here.

    You can use a formula such as

    =SUM(--(range=value))

    For example:

    You can also use the literal value in the formula:

    =SUM(--(A2:A13="28928813202104020000003265"))

    Remark: if you don't have Microsoft 365 or Office 2021, use SUMPRODUCT instead of SUM.

Resources