I'm looking to count the number of periods in a string and add values based on that number.

Here I have a hierarchy and it currently looks like this:
1
1.1
1.1.1
1.1.1.1
I need to modify it so that it will look like this:
1.0.0.0.0.0.0.0
1.1.0.0.0.0.0.0
1.1.1.0.0.0.0.0
1.1.1.1.0.0.0.0
I tried this equation in a column named [Item Hierarchy] which referenced a column named [Item]:
=IF(COUNTIF([Item]@row, CONTAINS(".", [Item]@row)) = 0, [Item]@row + ".0.0.0.0.0")
Thanks
Best Answer
-
=LEN(Item@row) - LEN(SUBSTITUTE(Item@row, ".", ""))
Try that
Dr. St Nicholas Burrus DHA, PMP
I build Smartsheets for the US Government, State Government, and about a dozen of the US Fortune 100s.
Answers
-
=LEN(Item@row) - LEN(SUBSTITUTE(Item@row, ".", ""))
Try that
Dr. St Nicholas Burrus DHA, PMP
I build Smartsheets for the US Government, State Government, and about a dozen of the US Fortune 100s.
-
That worked! thank you so much!
-
Damn, you're good, Nick. Just found this. Worked for me. Thanks.
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 66.9K Get Help
- 441 Global Discussions
- 153 Industry Talk
- 501 Announcements
- 5.4K Ideas & Feature Requests
- 85 Brandfolder
- 155 Just for fun
- 79 Community Job Board
- 511 Show & Tell
- 34 Member Spotlight
- 2 SmartStories
- 308 Events
- 37 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!