Am I using COUNTIF correctly?

charlesstricklin

Board Regular
Joined
May 6, 2013
Messages
98
Office Version
  1. 2021
Platform
  1. Windows
I'm a little puzzled, I'm sure because it's that I'm not understanding something correctly. Say that I've made a pivot table from the following data:

MonthCompany
JanuaryCompany A
JanuaryCompany B
FebruaryCompany A
FebruaryCompany B
FebruaryCompany A
FebruaryCompany B
FebruaryCompany C
FebruaryCompany A
FebruaryCompany B
MarchCompany A
MarchCompany B
MarchCompany B
MarchCompany B
MarchCompany C
MarchCompany B
AprilCompany A
AprilCompany B
AprilCompany A
AprilCompany A
AprilCompany B
AprilCompany C
AprilCompany A
AprilCompany B
MayCompany A

How do I use COUNTIF to count how many of Company B is in May? Or how do I count how many of Company C there are when I've chosen April only in my pivot table? Or do I use something other than COUNTIF? I'm confused. Do I use COUNIFS instead? BTW I'm using Windows Excel 2010, if that matters.
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
charles Let's get the ball rolling. Here is my solution to your problem. Now maybe this doesn't solve all your problems but we have to start somewhere. So let the discussion begin

24-02-04.xlsx
ABCDEF
1MonthCompany
2JanuaryCompany A
3JanuaryCompany BCompany A4
4FebruaryCompany AApril
5FebruaryCompany B
6FebruaryCompany A
7FebruaryCompany BJanuary
8FebruaryCompany CFebruary
9FebruaryCompany AMarch
10FebruaryCompany BApril
11MarchCompany AMay
12MarchCompany B
13MarchCompany B
14MarchCompany B
15MarchCompany C
16MarchCompany B
17AprilCompany A
18AprilCompany B
19AprilCompany A
20AprilCompany A
21AprilCompany B
22AprilCompany C
23AprilCompany A
24AprilCompany B
25MayCompany A
Data
Cell Formulas
RangeFormula
F3F3=COUNTIFS(B2:B25,D3,A2:A25,D4)
Cells with Data Validation
CellAllowCriteria
D3List=$B$20:$B$22
D4List=$D$7:$D$11
 
Upvote 0
You should be able to get your counts and filter your data in the pivot table without COUNTIF.

Set your pivot table up like this.
Then you can use the drop down arrows in the column and rows to filter by companies and months.

Book1
ABCDEFGHIJK
1MonthCompany
2JanuaryCompany A
3JanuaryCompany BCount of CompanyColumn Labels
4FebruaryCompany ARow LabelsJanuaryFebruaryMarchAprilMayGrand Total
5FebruaryCompany BCompany A1314110
6FebruaryCompany ACompany B134311
7FebruaryCompany BCompany C1113
8FebruaryCompany CGrand Total2768124
9FebruaryCompany A
10FebruaryCompany B
11MarchCompany A
12MarchCompany B
13MarchCompany B
14MarchCompany B
15MarchCompany C
16MarchCompany B
17AprilCompany A
18AprilCompany B
19AprilCompany A
20AprilCompany A
21AprilCompany B
22AprilCompany C
23AprilCompany A
24AprilCompany B
25MayCompany A
Sheet2


1707154080327.png
 
Upvote 0
Solution

Forum statistics

Threads
1,224,813
Messages
6,181,117
Members
453,021
Latest member
Justyna P

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