Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9782

Count cells with an integer in them as substring

$
0
0

Most cells in the column have a single integer in them, e.g. 5. Some cells have a range as a string, e.g. '4-5. (Let's ignore the problem where someone types 4-5 and the app interprets it as April 5th, and stores a date value.) Some cells have a single integer as text, e.g. '5. How can I count the number of cells in the column that have a specific integer anywhere in them, as text or number value?

  • =COUNTIF(A2:A88, 5)— counts 5 and '5, does not count '4-5
  • =COUNTIF(A2:A88, "5")— counts 5 and '5, does not count '4-5
  • =COUNTIF(A2:A88, "*5*")— counts '5 and '4-5, does not count 5

Ideally I want to coerce the displayed value to be text that is searched. (That would also solve the April 5th problem.) I want a solution that includes all of 5, '5, '4-5, and '5-6.


Viewing all articles
Browse latest Browse all 9782

Trending Articles