Multiple Criteria

kumara_faith

Well-known Member
Joined
Aug 19, 2006
Messages
922
Office Version
  1. 365
Hi,

I have the following table:

Book1
BCDEFGHIJKLMNOPQRSTUVWXYZ
2Table 1Table 3Table 4Table 5
3NameID NoPolicyBranchDateNameBranchID CardJanFebMarAprPayment TypeJanFebMarAprBranchJanFebMarApr
4Amy55487PRM55877Dallas1/1/2022Amy554870PremiumDallas
5Bryan66678NB44785New York2/2/2022Bryan66678LoanNew York
6John45487LOA55547Chicago3/2/2022John45487New BusinessChicago
7Javier25568PRM5544Seattle4/4/2022Javier25568Seattle
8Javier45464NB446558Boston1/1/2022JavierBoston
9
10Table 2
11CodeDescription
12PRMPremium
13LOALoan
14NBNew Business
Sheet1
Cell Formulas
RangeFormula
K4K4=COUNTIFS(B4:B8,H4,F4:F8,K3)
V4:V8V4=UNIQUE(E4:E8)
J4:J7J4=XLOOKUP(H4,$B$4:$B$8,$C$4:$C$8)
Dynamic array formulas.



1) Table 1 is the raw data
2) Table 2 is the code to identify the payment description. Example: In Table 1, the column for Policy shows that there is an abbreviation infron of the policy no. This identifies the payment type.
3 Table 3- I am trying to summarize based on the columns. For the name column, I tried using Unique but its not accurate because Javier has sales in both Seattle and Boston. In addition I am not sure how to populate the branch and the count of policies by month
4) Table 4- I am trying to summarize based on the columns. Payment type is derived from the codes in Table 2. This is the abbreviation used in the policies for Table 1. Example PRM0001 means Premium. I am not sure how to derive the count based on the data in Table 1.
5) Table 5 - I am trying to summarize based on the columns. I tried using Countifs but I am not sure how to specify the count by month based on the date in Table 1.

Appreciate any help.
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
So let's take this one step at a time.

I get what Tables 1 and 2 are showing.

What exactly do you want Table 3 to look like ?

Can you manually mock up a sample of Table 3, based on the raw data in post #1, so that we can see what it should look like ?
 
Upvote 0
Hi,

Here is the sample of the correct results for Table 3 , 4 and 5. The numbers in the month columns are counting the number of policies.

Book1
BCDEFGHIJKLMNOPQRSTUVWXYZ
2Table 1Table 3Table 4Table 5
3NameID NoPolicyBranchDateNameBranchID CardJanFebMarAprPayment TypeJanFebMarAprBranchJanFebMarApr
4Amy55487PRM55877Dallas1/1/2022AmyDallas554871Premium11Dallas1
5Bryan66678NB44785New York2/2/2022BryanNew York666781Loan1New York1
6John45487LOA55547Chicago3/2/2022JohnChicago454871New Business11Chicago1
7Javier25568PRM5544Seattle4/4/2022JavierSeattle255681Seattle1
8Javier45464NB446558Boston1/1/2022JavierBoston255681Boston1
9
10Table 2
11CodeDescription
12PRMPremium
13LOALoan
14NBNew Business
Sheet1
Cell Formulas
RangeFormula
V4:V8V4=UNIQUE(E4:E8)
J4:J8J4=XLOOKUP(H4,$B$4:$B$8,$C$4:$C$8)
Dynamic array formulas.
 
Upvote 0
OK good, thanks.
So in Table 3, the last line shows a 1 for the combination Javier / Boston / 25568.
But in Table 1, the line for Javier / Boston shows 45464, not 25568.
So I take it we can ignore ID card / ID no, and just refer to Name / Branch.
Is that correct ?
 
Upvote 0
Hi,

Apologies. Javier ID should be 25568 instead of 45464. The same agent can sell policies for customers from two locations.
 
Upvote 0
OK I understand, so I think it means we need to take name and location into account, but we can ignore ID.
I need to go away now, but will look in again over the weekend.
 
Upvote 0
See if this is good enough for what you are doing:

20220605 Count Multiple Criteria kumara_faith.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZ
1
2Table 1Table 3Table 4Table 5
3NameID NoPolicyBranchDateNameBranchID CardJanFebMarAprPayment TypeJanFebMarAprBranchJanFebMarApr
4Amy55487PRM55877Dallas1/01/2022Amy55487Dallas1000Premium1001Dallas1000
5Bryan66678NB44785New York2/02/2022Bryan66678New York0100Loan0100New York0100
6John45487LOA55547Chicago3/02/2022John45487Chicago0100New Business1100Chicago0100
7Javier25568PRM5544Seattle4/04/2022Javier25568Seattle0001Seattle0001
8Javier25568NB446558Boston1/01/2022Javier25568Boston1000Boston1000
9
10Table 2
11CodeDescription
12PRMPremium
13LOALoan
14NBNew Business
Modified
Cell Formulas
RangeFormula
H4:J8H4=UNIQUE(CHOOSE({1,2,3},$B$4:$B$8,$C$4:$C$8,$E$4:$E$8),FALSE,FALSE)
K4:N8K4=COUNTIFS($B$4:$B$8,$H4,$C$4:$C$8,$I4,$E$4:$E$8,$J4,$F$4:$F$8,"<=" & EOMONTH(DATEVALUE("01-"&K$3&"2022"),0),$F$4:$F$8,">" & EOMONTH(DATEVALUE("01-"&K$3&"2022"),-1))
Q4:T6Q4=COUNTIFS($D$4:$D$8,INDEX($B$12:$B$14,MATCH($P4,$C$12:$C$14,0),0) & "*",$F$4:$F$8,"<=" & EOMONTH(DATEVALUE("01-"&Q$3&"2022"),0),$F$4:$F$8,">" & EOMONTH(DATEVALUE("01-"&Q$3&"2022"),-1))
V4:V8V4=UNIQUE(E4:E8)
W4:Z8W4=COUNTIFS($E$4:$E$8,$J4,$F$4:$F$8,"<=" & EOMONTH(DATEVALUE("01-"&W$3&"2022"),0),$F$4:$F$8,">" & EOMONTH(DATEVALUE("01-"&W$3&"2022"),-1))
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,215,372
Messages
6,124,535
Members
449,169
Latest member
mm424

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