Formulas and Functions

Formulas and Functions

Ask for help with your formula and find examples of how others use formulas and functions to solve a similar problem.

Equation to sum children, if no children then return value from a different column

Hi - I"m looking for an equation in column A to sum the value of column B for any children rows. However, if there are no children, then I would like the equation to return the value in column B. I have a helper column set up so that parent/child can be distinguished with 0, 1 or 2 value based on hierarchy.

Any guidance much appreciated. Thanks,

Best Answer

  • ✭✭✭✭✭
    Answer ✓

    Hi @Karenmst!

    I would make another helper column for children due to a piece of criteria being if the row has no children. You can do this by using =COUNT(CHILDREN()).

    Assuming that new helper column is named "Helper - Children", you can use the following equation for your problem:

    =IF([Helper - Children]@row > 0, SUM(CHILDREN([column B]@row)), [column B]@row)

    I might've misunderstood your question so let me know if that doesn't work!

    Ashley Knight

    Lets Connect!

Answers

  • ✭✭✭✭✭
    Answer ✓

    Hi @Karenmst!

    I would make another helper column for children due to a piece of criteria being if the row has no children. You can do this by using =COUNT(CHILDREN()).

    Assuming that new helper column is named "Helper - Children", you can use the following equation for your problem:

    =IF([Helper - Children]@row > 0, SUM(CHILDREN([column B]@row)), [column B]@row)

    I might've misunderstood your question so let me know if that doesn't work!

    Ashley Knight

    Lets Connect!

  • That did the trick!! Thank you so much!

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!

Trending in Formulas and Functions