Welcome to the Smartsheet Forum Archives


The posts in this forum are no longer monitored for accuracy and their content may no longer be current. If there's a discussion here that interests you and you'd like to find (or create) a more current version, please Visit the Current Forums.

COUNTIF using Parent Rows Only

Jill Youngberg
Jill Youngberg โœญโœญโœญ
edited 12/09/19 in Archived 2017 Posts

I am trying to come up with a formula that would count only the parents rows.

Comments

  • J. Craig Williams
    J. Craig Williams โœญโœญโœญโœญโœญโœญ

    Jill,

    ย 

    A bit clarification please.

    All parents in a column?

    What about grand-parents, do they count?

    ย 

    You may need to have a column determining if the row is a parent and then count that column instead.

    ย 

    I was hoping something like this would work:

    ย 

    =COUNTIF(Example:Example, COUNT(CHILDREN(@cell)) > 0)

    ย 

    but the second level of @cell usage seems to confuse it (#UNPARSEABLE).

    ย 

    Craig

  • Brett Evans
    Brett Evans โœญโœญโœญโœญโœญโœญ

    Jill,

    I have been able to do that, but it took about 8 extra columns. ย It can handle grandparent, parent and child rows. ย My head started to hurt when adding another level. ย 

    ย 

    To Craig's question, what is the full use case that you are trying to achieve? ย The details can change the layout of this.

    ย 

    -Brett

  • Jill Youngberg
    Jill Youngberg โœญโœญโœญ

    I am pretty new at this so bear with me a bit.

    I have a parent row that rolls up information based on dates in the children rows. I am wanting to have a count of the parent rows only for each set (based on the different information that is rolled up per set)

  • Shaine Greenwood
    Shaine Greenwood Employee
    edited 02/28/17

    Jillโ€”

    ย 

    One possibility would be to add a parent row at the top of your sheet and place a =COUNTIF(CHILDREN(), DATE(yyyy,mm,dd))

    ย 

    You'd need to do a lot of indenting and doublechecking to make sure that your hierarchy is still in order.

    ย 

    Otherwise, you can place the formula in another cell (where ever you'd like), and reference the parent cells:ย 

    ย 

    =COUNTIF(CHILDREN([Column Name]4), DATE(yyyy,mm,dd)) +ย COUNTIF(CHILDREN([Column Name]20), DATE(yyyy,mm,dd)) + etc...

    ย 

    I'd recommend checking out our Creating Formulas article for details on function syntax in Smartsheet:ย https://help.smartsheet.com/articles/2476171-create-and-edit-formulas-in-smartsheet

    ย 

    You can find our complete list of functions available in Smartsheet here:ย https://help.smartsheet.com/articles/775363-using-formulas

This discussion has been closed.