Use a pivot table! Pivot tables are designed to do more or less exactly what you've asked for.
I can't upload an example, so please follow these steps (before dismissing the suggestion)
Select a cell in your range
Data -> pivot table & pivot chart report ->
Click through (defaults will be fine)
A pivot table pops up (blue boxes everywhere)
From the little window, drag "CATEGORY" to the "row fields" area - this should make a list of fruit appear in that column
Now drag "COUNT" to the data area
This should effectively replicate your table
Now...
Select each apple cell - like:
click on "apple"
ctrl+click on "Fuji apple"
ctrl+click on "red apple"
right click on red apple
group and show detail
group
You can rename "Group 1" by simply overwriting in the relevant cell
follow similar steps to group pears (select cells in the "ungrouped" column)
You shuold now have a table that looks like
Now... double-clicking on "Apples" or "Pears" will group/ungroup those groups - JAZZY!
CC
Bookmarks