How to count the number of children based on certain value of parent

The column name is [Task] and a cell value called "Project Details" is located somewhere in the column. Their children is project 1, project2, ... etc....

I want to count the number of children under "Project Details". I know that if the position of the cell "Project Details" is fixed. I can use formula like this: count(children([Task]1))

However, the parent cell is not always in the same position. I try the following formula but it is not working:

countif([Task]:[Task], Parent(@cell) = "Project Details")


Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!