Hi @blawrence13
To do that kind of repetitive work in the formula, it is best to use many helper columns and the same formula pattern, changing only column name numbers and writing the formula systematically.
First, I removed all the S, F, d, +, - from the Predecessors column with this formula;
[Pred Delete SFd+-]
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(Predecessors@row, "F", ""), "S", ""), "d", ""), "+", ""), "-", "")
Then, find the "," position with the following formula;
[c1] =IF(ISNUMBER([c0]@row), IF(FIND(",", [Pred Delete SFd+-]@row, [c0]@row + 1) > 0, FIND(",", [Pred Delete SFd+-]@row, [c0]@row + 1), ""), "")
[c2] =IF(ISNUMBER([c1]@row), IF(FIND(",", [Pred Delete SFd+-]@row, [c1]@row + 1) > 0, FIND(",", [Pred Delete SFd+-]@row, [c1]@row + 1), ""), "")
[c3] =IF(ISNUMBER([c2]@row), IF(FIND(",", [Pred Delete SFd+-]@row, [c2]@row + 1) > 0, FIND(",", [Pred Delete SFd+-]@row, [c2]@row + 1), ""), "")
[c4] =IF(ISNUMBER([c3]@row), IF(FIND(",", [Pred Delete SFd+-]@row, [c3]@row + 1) > 0, FIND(",", [Pred Delete SFd+-]@row, [c3]@row + 1), ""), "")
You will notice that I am just changing the [cx]'s x from 0 to 3. FYI, [c0]=0.
Then, I get the text or string separated by "," with this formula;
[p1] =IF(ISNUMBER([c1]@row), MID([Pred Delete SFd+-]@row, [c0]@row + 1, [c1]@row - [c0]@row - 1), [Pred Delete SFd+-]@row) # In this case, you just return [Pred Delete SFd+-]@row if there is no ",".
[p2] =IF(ISNUMBER([c2]@row), MID([Pred Delete SFd+-]@row, [c1]@row + 1, [c2]@row - [c1]@row - 1), "")
[p3] =IF(ISNUMBER([c3]@row), MID([Pred Delete SFd+-]@row, [c2]@row + 1, [c3]@row - [c2]@row - 1), "")
[p4] =IF(ISNUMBER([c4]@row), MID([Pred Delete SFd+-]@row, [c3]@row + 1, [c4]@row - [c3]@row - 1), "")
Finally, you can get the Predecessors number string values with the following formula by bringing the left side of " " if there is " "; for example, "3 2" means predecessor 3 and lag of 2 days, but you want the predecessor 3.
[Pred 1] =IF(FIND(" ", [p1]@row) > 0, LEFT([p1]@row, FIND(" ", [p1]@row) - 1), [p1]@row)
[Pred 2] =IF(FIND(" ", [p2]@row) > 0, LEFT([p2]@row, FIND(" ", [p2]@row) - 1), [p2]@row)
[Pred 3] =IF(FIND(" ", [p2]@row) > 0, LEFT([p2]@row, FIND(" ", [p2]@row) - 1), [p2]@row)
[Pred 4] =IF(FIND(" ", [p4]@row) > 0, LEFT([p4]@row, FIND(" ", [p4]@row) - 1), [p4]@row)
With those predecessors, you can get predecessors No 3 and 4's status with the following formula;
[Pred 3 Status] =IF(ISBLANK([pred 3]@row), "", INDEX([Manual Status]:[Manual Status], VALUE([pred 3]@row)))
[Pred 4 Status] =IF(ISBLANK([pred 4]@row), "", INDEX([Manual Status]:[Manual Status], VALUE([pred 4]@row)))
Like many users, you might wish Smartsheet had a built-in "Split" function similar to Excel or Google Sheets. This can feel limiting when working with data that needs separation.
Well, that was a fun two hours with Smartsheet formulas, according to the activity log.😁
https://app.smartsheet.com/b/publish?EQBCT=fbfd98a0a65f47c78c6baff9a20f32aa
How to use the data in the Predecessor Column as a variable.
Im trying to use the number inside of the predecessor column to call out the location of the row to get information from that row.
=VLOOKUP([Predecessors]@row, {Predecessors}, {column x}, false)
=INDEX([column x], MATCH([Predecessors]@row, [Row]))
none of these seem to work. Is there a way to call the predecessor column as a int. IE the predecessor is row 10. =[column x]10
Best Answers
-
VALUE(Predecessors@row + "") worked for me.
=IF(ISBLANK(Predecessors@row), "", INDEX([Task Name]:[Task Name], VALUE(Predecessors@row + "")))
If you test the Predecessors@row with ISNUMBER and ISTEXT, the result shows that the predecessor is neither a number nor a text. So, to use it in INDEX or VLOOKUP, I converted the value first to text by adding "" and then used the VALUE function to convert it to a number.
https://app.smartsheet.com/b/publish?EQBCT=6ab5b2a32e4542ee9417dd112fb2c90b
-
Unreal, it works perfect thank you!
Answers
-
VALUE(Predecessors@row + "") worked for me.
=IF(ISBLANK(Predecessors@row), "", INDEX([Task Name]:[Task Name], VALUE(Predecessors@row + "")))
If you test the Predecessors@row with ISNUMBER and ISTEXT, the result shows that the predecessor is neither a number nor a text. So, to use it in INDEX or VLOOKUP, I converted the value first to text by adding "" and then used the VALUE function to convert it to a number.
https://app.smartsheet.com/b/publish?EQBCT=6ab5b2a32e4542ee9417dd112fb2c90b
-
Unreal, it works perfect thank you!
-
@jmyzk_cloudsmart_jp Have you found a way to do this in a row with multiple predecessors?
-
Hi @Lindsay AR
Using the SUCCESSORS function is my favorite, as the function removes the Predecessors format like SS, FF, etc.
(Link to the published demo sheet)
Related Discussion
-
Thanks! I figured it out later in the day but that helps assure I did it similar to how others have made it work as well.
-
Happy to help!😁 @Lindsay AR
-
Hi @jmyzk_cloudsmart_jp, thanks so much for all your time working on this…what if my predecessors (more than 1) is quite simple, just simple numbers with a comma to denote the multiple predecessor? Is it possible to return the value of the two or three predecessors using helper columns and maintaining the dynamic nature (say a line is inserted, the predecessor value naturally changes too)?
-
Suppose we have a sheet like the image below, with some tasks having as many as four predecessors.
First, I added a [Pred Multi] helper multiple dropdown list column, as I want to count the number of predecessors with the COUNTM function in the next helper column, [Pred Count].
So, our task is to split and get the value from a predecessor cell, such as "10, 11, 12, 13."
To do that, we use the TEXT functions, like FIND, MID, and SUBSTITUTE. I used the FIND and MID functions to cope systematically with many predecessor cases, like 10.
Formulas
[Pred Multi] =SUBSTITUTE(Predecessors@row, ",", CHAR(10))
[Pred Count] =COUNTM([Pred Multi]@row)
[F1] =IF([Pred Count]@row > 1, FIND(",", Predecessors@row))
[F2] =IF([Pred Count]@row > 2, FIND(",", Predecessors@row, [F1]@row + 1))
[F3] =IF([Pred Count]@row > 3, FIND(",", Predecessors@row, [F2]@row + 1))
[Predecessor 1] =IF(ISBLANK([F1]@row), Predecessors@row, MID(Predecessors@row, 1, [F1]@row - 1))
[Predecessor 2] =IF([Pred Count]@row = 2, MID(Predecessors@row, [F1]@row + 1, LEN(Predecessors@row) - [F1]@row), IF([Pred Count]@row > 2, MID(Predecessors@row, [F1]@row + 1, [F2]@row - [F1]@row - 1)))
[Predecessor 3] =IF([Pred Count]@row = 3, MID(Predecessors@row, [F2]@row + 1, LEN(Predecessors@row) - [F2]@row), IF([Pred Count]@row > 3, MID(Predecessors@row, [F2]@row + 1, [F3]@row - [F2]@row - 1)))
[Predecessor 4] =IF([Pred Count]@row = 4, MID(Predecessors@row, [F3]@row + 1, LEN(Predecessors@row) - [F3]@row))As you notice from the above formulas, the formulas have the repetitive same structures, with only specific numbers changing, like >1, >2, or F1, F2.
So, if you need to cope with a Project with some tasks having more than four predecessors, you just need to add more helper columns, only changing the numbers. -
@jmyzk_cloudsmart_jp : that totally works!!! So now my next step was to get the predecessor 1 task name using your original formula and I substituted instead of predecessors, predecessor 1 and it totally worked too! I'm so so happy.
since it works, everything is great, but out of curiosity, for your screenshot (and also on mine) I don't understand F2 and F3…what does it "mean"….so in your example, on line 10: F2 is 5 and F3 is 8 …what is the "5" and "8" denoting? Thanks so much in advance!
-
I'm glad it worked.
Regarding your question on what F1, F2, etc., denote, for example, in the image below, F1, F2, etc., denote the position of "," in the Predecessors cell.
10, 11, 12, 13
First '," or F1 is at position 3, as in the "10,", the "," is at the 3rd position,
second "," or F2 is at position 7, as "10, 11,", the second "," is seventh position.The formula for [F2] below finds "," from the [F1]@row+1 or the 3rd position.
[F2] =IF([Pred Count]@row > 2, FIND(",", Predecessors@row, [F1]@row + 1))
Syntax: FIND(search_for, text_to_search, [start_position])
"
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 66.6K Get Help
- 435 Global Discussions
- 152 Industry Talk
- 495 Announcements
- 5.3K Ideas & Feature Requests
- 85 Brandfolder
- 155 Just for fun
- 77 Community Job Board
- 508 Show & Tell
- 34 Member Spotlight
- 2 SmartStories
- 308 Events
- 37 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!