Countifs, Sum Product and Unique Entries

rex759

Well-known Member
Joined
Nov 8, 2004
Messages
610
Office Version
  1. 365
Platform
  1. Windows
Hello,

The formula counts the number of occurrences if the IDs are Unique and falls between certain dates. I also want to include the sales person into the mix. In the below example, the results should be one since Bill has one unique ID that falls between the date range.

I tried adding the reference to the formula but could not get it to work.

Any help is appreciated.



Book1
ABCDEFG
1IDSales AssocDate4/1/174/30/17Bill
21471490339Bill4/11/17
31471490339Bill4/11/172
41471490339Bill4/11/17
51471731669Rick4/26/17
61471731669Rick4/26/17
71473630635Bill10/20/17
8
Sheet3
Cell Formulas
RangeFormula
F3{=SUMPRODUCT(IF((D2:D8<=F1)*(D2:D8>=E1), 1/COUNTIFS(D2:D8, "<="&F1, D2:D8, ">="&E1, B2:B8, B2:B8),0))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
[TABLE="class: grid"]
<tbody>[TR]
[TD][/TD]
[TD]
A
[/TD]
[TD]
B
[/TD]
[TD]
C
[/TD]
[TD]
D
[/TD]
[TD]
E
[/TD]
[TD]
F
[/TD]
[/TR]
[TR]
[TD]
1
[/TD]
[TD]
ID
[/TD]
[TD]
Sales Assoc
[/TD]
[TD]
Date
[/TD]
[TD]
4/1/2017
[/TD]
[TD]
4/30/2017
[/TD]
[TD]Bill[/TD]
[/TR]
[TR]
[TD]
2
[/TD]
[TD]
1471490339
[/TD]
[TD]Bill[/TD]
[TD]
4/11/2017
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
3
[/TD]
[TD]
1471490339
[/TD]
[TD]Bill[/TD]
[TD]
4/11/2017
[/TD]
[TD][/TD]
[TD]
1​
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
4
[/TD]
[TD]
1471490339
[/TD]
[TD]Bill[/TD]
[TD]
4/11/2017
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
5
[/TD]
[TD]
1471731669
[/TD]
[TD]Rick[/TD]
[TD]
4/26/2017
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
6
[/TD]
[TD]
1471731669
[/TD]
[TD]Rick[/TD]
[TD]
4/26/2017
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
7
[/TD]
[TD]
1473630635
[/TD]
[TD]Bill[/TD]
[TD]
10/20/2017
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

e3=SUM(IF(FREQUENCY(IF(C2:C7>=D1,IF(C2:C7<=E1,IF(B2:B7=F1,MATCH(B2:B7,B2:B7,0)))),ROW(B2:B7)-ROW(B2)+1),1))

control+shift+enter
 
Upvote 0
Hello,

Thanks for responding.

I made one change to your formula and it worked for me.

e3=SUM(IF(FREQUENCY(IF(C2:C7>=D1,IF(C2:C7<=E1,IF(B2:B7=F1,MATCH(A2:A7,A2:A7,0)))),ROW(B2:B7)-ROW(B2)+1),1))

control+shift+enter

Thanks again
 
Upvote 0

Forum statistics

Threads
1,223,898
Messages
6,175,272
Members
452,628
Latest member
dd2

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