Counting Based on Pivot Table Summary

leefletcher

New Member
Joined
Mar 22, 2018
Messages
29
Office Version
  1. 2019
Platform
  1. Windows
My data looks like this:

NameFood
BlueBag
BlueCan
BuddyBag
BellaHomemade
LunaBag
LunaCan
LunaHomemade

My pivot table looks like this:
NameBagCanHomemade
Bella1
Blue11
Buddy1
Luna111

I want to know how many animals fit into the different combination of categories. These are the relevant ones:

CategoryCount
Bag Only1
Can Only0
Homemade Only1
Bag and Can1
Bag, Can, and Homemade1

Please help!
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Do you mean like this : ?

Book1
ABCDEFGHIJKL
1NameFoodCount of FoodColumn Labels
2BlueBagRow LabelsBagCanHomemadeGrand Total
3BlueCanBella11
4BuddyBagBlue112
5BellaHomemadeBuddy11
6LunaBagLuna1113
7LunaCanGrand Total3227
8LunaHomemade
9
10
11
Sheet1


1724932068759.png
 
Upvote 1
You can do it with a series of COUNTIFS formulas looking at the pivot table. Assuming the pivot is in cols A:D

Bag Only: =COUNTIFS(B:B,">0",C:C,0,D:D,0)
Can Only: =COUNTIFS(B:B,0,C:C,">0",D:D,0)
Homemade Only: =COUNTIFS(B:B,0,C:C,0,D:D,">0")
Bag and Can: =COUNTIFS(B:B,">0",C:C,">0",D:D,0)
Bag, Can, and Homemade: =COUNTIFS(B:B,">0",C:C,">0",D:D,">0")
 
Upvote 0
Solution
You can do it with a series of COUNTIFS formulas looking at the pivot table. Assuming the pivot is in cols A:D

Bag Only: =COUNTIFS(B:B,">0",C:C,0,D:D,0)
Can Only: =COUNTIFS(B:B,0,C:C,">0",D:D,0)
Homemade Only: =COUNTIFS(B:B,0,C:C,0,D:D,">0")
Bag and Can: =COUNTIFS(B:B,">0",C:C,">0",D:D,0)
Bag, Can, and Homemade: =COUNTIFS(B:B,">0",C:C,">0",D:D,">0")
Thank you. This works great. I was going about it the wrong way by trying to create the 5 columns (i.e., bag only, can only, etc) each checking the data by rows (e.g., Bag=1, Can=0, Homemade=0).

The formulas above were not counting the empty cells using 0, so I substituted "" and they work great.

Thank you, again.
 
Upvote 0

Forum statistics

Threads
1,221,519
Messages
6,160,294
Members
451,636
Latest member
ddweller151

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top