IF statement with child/parent logic

Lauren@MI
Lauren@MI
edited 12/09/19 in Formulas and Functions

The Problem:

I need to have autonumber as a Unique Identifier for each row. When that row changes due to changing business requirements, I want to create a child row but it should not have a different Unique ID from the parent. It could either have the same Unique ID or no Unique ID, but if I have autonumber turned on then Smartsheet automatically numbers every single row separately.

 

Attempted Solution:

1. Use autonumber, which creates a Unique ID for every row (even child rows)

2. Create a calculation column to reference the autonumber column. I need help writing the formula for the logic "if row is a child row, then calculation field equals the Unique ID of the parent row. If not, then calculation field equals the Unique ID." 

In the attached screenshot, it would be something like "IF((row = child), [Campaign ID]5=Parent([Campaign identifier]),[Campaign ID]5=[Campaign identifier]5)"

 

Any tips?

smartsheetsnip.PNG

Comments

  • SYSPK
    SYSPK ✭✭✭✭✭✭

    Do your children rows have any children of their own?

    If not, that helper column can be: IF(COUNT(CHILDREN())>0,[campaign identifier]@row,PARENT()

    You're telling it that if it's a parent row, to give the unique ID of that row. If it's a child, to give the parent value (which is its unique ID). 

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!