CountIf Parent Hierarchy Column and Secondary Column
I apologize if this has been asked. I am trying to figure out a Countif formula combined 2 columns.
Column 1 is a hierarchy level column in 5 levels (0=great-grandparent, 1=grandparent, 2=grandparent, 3=child, 4=child).
Column 2 is a internal priority level with 4 levels (High, Medium, Low, N/A).
I want to get count of all the levels at the child level but in groups (how many high, how many medium and so forth.
I have only figured out how to do the grand count total for all in Column 1
=COUNTIF([Column 1]1:[Column 1]308, 3) = 70.
But how do I do the combined CountIF?
In English it would say, if Column 1 is equal to 3, then count "High" in Column 2.
I would have 4 of these formlas (for each level) and these 4 should equal 70.
Make sense?
Comments
-
Try using a Countifs formula. https://help.smartsheet.com/function/countifs
=countifs([Column 1]1:[Column 1]308, 3, [Column 2]1:[Column 2]308, "High")
The countifs formula is looking for multiple criterion. Here you are saying that you want column 1 to = 3 and Column 2 to equal high to count the item.
-
This worked. Thank you.
How do I add an OR to it? I have decided to add a third criteria and can't figure what I am doing wrong. I referred to some other formulas, and thought I matched it but it brings it back as UNPARSEABLE.
=COUNTIFS ([#Ancestor]:[#Ancestor], 3, Level:Level, "AAA", Greenlit:Greenlit, OR("Green", "Yellow"))
I also tried
=COUNTIFS ([#Ancestor]:[#Ancestor], 3, Level:Level, "AAA", Greenlit:Greenlit, OR(@cell="Green", @cell= "Yellow"))
If I was to run it as a filter it would read:
If #Ancestor = 3
If Level = AAA
If Greenlight = Green or Yellow
Then show result.
The count should show 12. Basically I don't want to show / count anything that is a Red or Blue status but if I do a range, if I resort it keeps it in the sort. (ie if I move something from Green Status to Red Status I don't want to count it but if it's in the range, it retains the range - does that make sense?).
-
Nice... using the @cell... If that works, great. I have had a TERRIBLE time getting OR statements to work inside Count or Sum IFS. I usually do the formula for one, + the formula for the other... so in your case it would be...
=COUNTIFS ([#Ancestor]:[#Ancestor], 3, Level:Level, "AAA", Greenlit:Greenlit, "Green")+COUNTIFS ([#Ancestor]:[#Ancestor], 3, Level:Level, "AAA", Greenlit:Greenlit, "Yellow")
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.9K Get Help
- 439 Global Discussions
- 138 Industry Talk
- 471 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 67 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!