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
- Customer Resources
- 64.8K Get Help
- 434 Global Discussions
- 138 Industry Talk
- 470 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 65 Community Job Board
- 486 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!