Next earliest date after today

Hello,

I want my parent row to input the next earliest date after today from my child rows. I am using the following syntax but it is not working, please help.

=MIN(CHILDREN([Scheduled ACP visit]@row) > TODAY())

Best Answer

  • KPH
    KPH ✭✭✭✭✭✭
    Answer ✓

    Hi @Inara

    You can't include a criteria in the CHILDREN function, only a reference. But you can use a COLLECT function to collect the child rows that match a criteria, like this:

    COLLECT(CHILDREN([Scheduled ACP visit]@row), CHILDREN([Scheduled ACP visit]@row), >TODAY())

    This says collect the children of Scheduled ACP visit

    If the value for the children of Scheduled ACP visit

    is greater than today's date.

    Then you can use your MIN function on that to find the soonest date.

    =MIN(COLLECT(CHILDREN([Scheduled ACP visit]@row), CHILDREN([Scheduled ACP visit]@row), >TODAY()))

Answers

  • KPH
    KPH ✭✭✭✭✭✭
    Answer ✓

    Hi @Inara

    You can't include a criteria in the CHILDREN function, only a reference. But you can use a COLLECT function to collect the child rows that match a criteria, like this:

    COLLECT(CHILDREN([Scheduled ACP visit]@row), CHILDREN([Scheduled ACP visit]@row), >TODAY())

    This says collect the children of Scheduled ACP visit

    If the value for the children of Scheduled ACP visit

    is greater than today's date.

    Then you can use your MIN function on that to find the soonest date.

    =MIN(COLLECT(CHILDREN([Scheduled ACP visit]@row), CHILDREN([Scheduled ACP visit]@row), >TODAY()))

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!