ANCESTORS Function

Used within another function to reference all of the ancestors in a cell’s hierarchy

Syntax

ANCESTORS([reference])
  • reference—[optional]
    The cell for which you want the ancestors. If no cell is specified, the function references the ancestors of the current cell.

Sample usage

COUNT(ANCESTORS([Task Name]4))

Examples

This example references the following sheet information:

Row #ProjectLEVELItem NumberCost Per UnitDue Date
1- Men's Formal Button Down0MF01$38.7502/27/19
2  MF01 - Design Phase1DP$25.0002/19/19
3-- MF01 - Assembly1A0$13.7502/27/19
4    Cutout Shirts2A001$10.0002/22/19
5    Sew Shirt2A002$2.5002/26/19
6    Add Buttons2A003$1.2502/26/19

Given the table above, here are some examples of using ANCESTOR in a sheet:

FormulaDescriptionResult(s)
=COUNT(ANCESTORS())

Counts the number of ancestors for the cell containing the formula

This formula is within each row of the Level column.

Row one: 0

Row two & three: 1

Row four through six: 2

=SUM(ANCESTORS([Cost Per Unit]5))

Sums the ancestors for row 5 in the Cost Per Unit column

It has two ancestor rows (rows 3 and 1).  

$52.50
=INDEX(ANCESTORS([Item Number]2), 2) + " - " + "Design Phase"Returns the ancestor of the value in row 2 of the Item Number column, then adds the values - Design Phase to the result MF01 - Design Phase

Still need help?

Use the Formula Handbook template to find more support resources, and view 100+ formulas, including a glossary of every function that you can practice working with in real time, and examples of commonly used and advanced formulas.

Find examples of how other Smartsheet customers use this function or ask about your specific use case in the Smartsheet online Community.

Ask the Community