How to count how many times a number appears in a string?
For example, if a cell contains the number 4500 and I want to count how many times 0 appears, I'd expect the formula to return a value of 2. Every formula I've tried simply checks if 0 is in the string at all and returns 1 for true and 0 for false.
Answers
-
Try this
=LEN(String@row) - LEN(SUBSTITUTE(String@row, "0", ""))
-
Hey @Logan Burke
Building on Paul's formula above, if the number(s) you are searching for are more than one digit long you might need this. The x represents the number(s) you are searching for.
(LEN(String@row) - LEN(SUBSTITUTE(String@row, "x", ""))) / LEN("x")
cheers
Kelly
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 62.9K Get Help
- 377 Global Discussions
- 207 Industry Talk
- 440 Announcements
- 4.5K Ideas & Feature Requests
- 139 Brandfolder
- 129 Just for fun
- 130 Community Job Board
- 449 Show & Tell
- 30 Member Spotlight
- 1 SmartStories
- 289 Events
- 33 Webinars
- 7.3K Forum Archives