Use only parent rows in a referenced sheet
I'm trying to count the number of times a text string is found in a different sheet in columns of the same name, but I only want to count if the name is in a parent row of the referenced sheet. The formula below is #unparseable. What is wrong with it?
=COUNTIF({Sheet1 Names}, CONTAINS(Names@row, @cell), {Sheet1 Names}, count(ancestors(@cell))=0)
Thank you, John
Best Answer
-
A couple of things...
To have multiple range/criteria sets, you will have to use COUNTIFS instead of COUNTIF. Additionally, hierarchy based functions cannot be used in cross sheet formulas.
You are going to want to insert a column on the sheet containing the source data, put your
=COUNT(ANCESTORS())
there, then reference this new column in your COUNTIFS.
=COUNTIFS({Sheet1 Names}, CONTAINS(Names@row, @cell), {Sheet1 New Column}, @cell = 0)
Answers
-
A couple of things...
To have multiple range/criteria sets, you will have to use COUNTIFS instead of COUNTIF. Additionally, hierarchy based functions cannot be used in cross sheet formulas.
You are going to want to insert a column on the sheet containing the source data, put your
=COUNT(ANCESTORS())
there, then reference this new column in your COUNTIFS.
=COUNTIFS({Sheet1 Names}, CONTAINS(Names@row, @cell), {Sheet1 New Column}, @cell = 0)
-
I wasn't aware that hierarchy-based functions couldn't be used in a cross sheet formula. (I had considered creating the helper column for the hierarchy in the source sheet, but I was hoping not to create another column.) Thanks!😃
-
Happy to help. 👍️
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 63.5K Get Help
- 402 Global Discussions
- 213 Industry Talk
- 450 Announcements
- 4.7K Ideas & Feature Requests
- 141 Brandfolder
- 135 Just for fun
- 56 Community Job Board
- 454 Show & Tell
- 31 Member Spotlight
- 1 SmartStories
- 296 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!