You can sometimes get a bit extra out of a pivot table by using helper columns on the data.
In this case I used 5 extra columns. I guess the logic count be "compressed" and I could probably get away with two.
In the first two columns (E:F) I use COUNTIFS to count the number of times a student appears in the 2-year and 4-year category.
In column G, I determine if a student is in both or only one category. If only one category, this number is zero. If not, it's as sum of the 2-year and 4-year. I could have just as well assigned 0 and 1 or False and True.
In column H, I determine a category based on what is in columns E:G.
=IF([@Both]>0,"2-year&4-year",IF([@[2-year]]>0,"2-year",IF([@[4-year]]>0,"4-year","Unknown")))
It is important that the strings "2-year" and "4-year" appear in the Category for both.
Column I contains a True / False value based on matching the Category String with the selection in Cell L1.
=ISNUMBER(FIND($L$1,[@Category]))
Cell L1 is actually a pivot table but all it has is a filter based on the Category column. This forces you to select a correct value.
Then there is the pivot table below it. This is where your answer appears. Unfortunately you have to refresh this table after you make the selection in cell L1. This could be done automatically with some VBA.
Bookmarks