Count number of specific characters in a string

JacobL
JacobL
edited 12/09/19 in Smartsheet Basics

Hi! I'm trying to write a formula that will give me the level of an item in a Work Breakdown Structure (WBS). The formula needs to read the number of decimals in a string. For example:

  • 1 = 1
  • 2.12 = 2
  • 3.1.14 = 3
  • 2.1.1.1 = 4
  • 2.327.1 = 3

The FIND function seems to be heading down the right track (by selecting the "." character from the string) but it only returns the first occurrence of the character. Any tips that would send me in the right direction?

Thank you,

Jake

Comments

  • Nic Larsen
    Nic Larsen ✭✭✭✭✭✭
    edited 12/18/18

    We use a helper column that counts the levels which we then use for conditional formatting. This may not be exactly what you need but it will count levels down. 

    =IF(COUNT(CHILDREN([Column Name]@row)) > 0, COUNT(ANCESTORS()) + 1)