Countifs and Sumifs with OR logic and Unique values

maelstromm

New Member
Joined
Mar 17, 2015
Messages
12
Office Version
  1. 365
Platform
  1. Windows
I did a search and couldn't find a good combination of how to use Countifs, Sumifs using UNIQUE values with multiple criteria for the data below.
Here is my ask:
  1. Get a unique count of the number of times a Company appears along with the value of their business based on the name of the event.
  2. Only be based on the Tier 1 and 2 relationship.
  3. Change the lookup up to dynamically increase based on values in Row A. I don't expect there to be zero values in Column A
The formulas I have for Countifs and Sumifs are as follows.
  • Company Count: SUM(COUNTIFS(F2:F11,"Yes",E2:E11,{"1","2"},A2:A11,"Event1")
  • Company Value: SUM(SUMIFS(G2:G11,F2:F11,"Yes",E2:E11,{"1","2"},A2:A11,"Event1"))

This is based on creating a separate sheet that eliminates the duplicates in Column C.

EventDateCompanyNameTierClientAccount
Event 1
5/1/2020​
Company 1Adam
1​
Yes
$10,000​
Event 1
5/1/2020​
Company 1Bill
1​
Yes
$10,000​
Event 1
5/1/2020​
Company 2Betty
2​
Yes
$2,000​
Event 1
5/1/2020​
Company 2Sam
2​
Yes
$2,000​
Event 1
5/1/2020​
Company 3JoeNo
Event 2
6/1/2020​
Company 4Joan
2​
Yes
$4,000​
Event 2
6/1/2020​
Company 4Sally
2​
Yes
$4,000​
Event 2
6/1/2020​
Company 4Susie
3​
Yes
$1,000​
Event 2
6/1/2020​
Company 5David
3​
Yes
$1,000​
Event 2
6/1/2020​
Company 6NormNo
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
I suggest that you update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

How about
+Fluff v2.xlsm
ABCDEFGHIJKL
1EventDateCompanyNameTierClientAccount
2Event 101/05/2020Company 1Adam1Yes£10,000Company 1220000
3Event 101/05/2020Company 1Bill1Yes£10,000Company 224000
4Event 101/05/2020Company 2Betty2Yes£2,000Company 300
5Event 101/05/2020Company 2Sam2Yes£2,000Company 400
6Event 101/05/2020Company 3JoeNoCompany 500
7Event 201/06/2020Company 4Joan2Yes£4,000Company 600
8Event 201/06/2020Company 4Sally2Yes£4,000
9Event 201/06/2020Company 4Susie3Yes£1,000
10Event 201/06/2020Company 5David3Yes£1,000
11Event 201/06/2020Company 6NormNo
12
Data
Cell Formulas
RangeFormula
K2:K7K2=SUM(COUNTIFS(F:F,"Yes",E:E,{1,2},A:A,"Event 1",C:C,J2))
L2:L7L2=SUM(SUMIFS(G:G,F:F,"Yes",E:E,{1,2},A:A,"Event 1",C:C,J2))
 
Upvote 0
Maybe I'm overthinking it, but this is how I interpreted the requirement (note that I've changed the table so that there are multiple valid results for 'Company 1').
Book1
ABCDEFGHIJK
1EventDateCompanyNameTierClientAccountCompany 1AccountCount
2Event 105/01/2020Company 1Adam1Yes10000Company 1160003
3Event 105/01/2020Company 1Bill1Yes10000
4Event 105/01/2020Company 1Betty2Yes2000
5Event 105/01/2020Company 1Sam2Yes2000
6Event 105/01/2020Company 1JoeNo
7Event 106/01/2020Company 1Joan2Yes4000
8Event 106/01/2020Company 1Sally2Yes4000
9Event 106/01/2020Company 1Susie3Yes1000
10Event 106/01/2020Company 1David3Yes1000
11Event 106/01/2020Company 1NormNo
Sheet3
Cell Formulas
RangeFormula
I2I2=UNIQUE(FILTER(C2:C11,(A2:A11="Event 1")*((E2:E11=1)+(E2:E11=2))*(F2:F11="Yes"),""))
J2J2=SUM(UNIQUE(FILTER(G2:G11,(A2:A11="Event 1")*((E2:E11=1)+(E2:E11=2))*(F2:F11="Yes"),"")))
K2K2=COUNT(UNIQUE(FILTER(G2:G11,(A2:A11="Event 1")*((E2:E11=1)+(E2:E11=2))*(F2:F11="Yes"),"")))
 
Upvote 0
You could well be right, we'll just have to wait for some clarification from the OP.
 
Upvote 0
Thank you both. To be more clear, this is the output I am looking for:

Event NameCompany CountTotal Value
Event 12$12000
Event 21$4000
 
Upvote 0
Thanks for updating your profile, how about
+Fluff v2.xlsm
ABCDEFGHIJKL
1EventDateCompanyNameTierClientAccount
2Event 101/05/2020Company 1Adam1Yes£10,000Event 1212000
3Event 101/05/2020Company 1Bill1Yes£10,000Event 214000
4Event 101/05/2020Company 2Betty2Yes£2,000
5Event 101/05/2020Company 2Sam2Yes£2,000
6Event 101/05/2020Company 3JoeNo
7Event 201/06/2020Company 4Joan2Yes£4,000
8Event 201/06/2020Company 4Sally2Yes£4,000
9Event 201/06/2020Company 4Susie3Yes£1,000
10Event 201/06/2020Company 5David3Yes£1,000
11Event 201/06/2020Company 6NormNo
12
Data
Cell Formulas
RangeFormula
J2:J3J2=UNIQUE(FILTER(A2:A100,A2:A100<>""))
K2:K3K2=ROWS(UNIQUE(FILTER($C$2:$C$100,($A$2:$A$100=J2)*($F$2:$F$100="Yes")*(($E$2:$E$100=1)+($E$2:$E$100=2)))))
L2:L3L2=SUM(UNIQUE(FILTER($G$2:$G$100,($A$2:$A$100=J2)*($F$2:$F$100="Yes")*(($E$2:$E$100=1)+($E$2:$E$100=2)))))
Dynamic array formulas.
 
Upvote 0
Solution
I had much the same as @Fluff, just took me a bit longer to do it. Only thing I had different was the first formula,
Excel Formula:
=UNIQUE(FILTER(A2:A100,((E2:E100=1)+(E2:E100=2))*(F2:F100="Yes"),""))
to omit any event that doesn't meet the tier or client criteria.
 
Upvote 0
Thank you both!! It worked like a charm. I preferred the first solution because I don't want to exclude any event, but added an ISERROR to avoid #CALC errors when an Event doesn't contain the filter criteria!
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,477
Messages
6,125,036
Members
449,205
Latest member
Eggy66

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