Excel function for distinct count based on dates match

samshaik

New Member
Joined
Jul 30, 2019
Messages
5
Hello,

I have data set where order ID's get created for every purchase transaction, whenever there is a change in transaction same order id gets updated and forms a new row.
Now i wanted to distinct count how many orders i received per calendar day where the calendar dates sits out side of the data set.

Appreciate if you guys could help me with the solution. Many thanks.

[TABLE="width: 0"]
<tbody>[TR]
[TD]id[/TD]
[TD]creation time[/TD]
[TD][/TD]
[TD][/TD]
[TD]Calendar[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]285[/TD]
[TD]11/20/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD]11/20/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD]Output[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]285[/TD]
[TD]11/20/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD]11/21/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD]Calendar date[/TD]
[TD]Distinct ID's count[/TD]
[/TR]
[TR]
[TD]286[/TD]
[TD]11/20/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD]11/22/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD]11/20/2018[/TD]
[TD]10[/TD]
[/TR]
[TR]
[TD]286[/TD]
[TD]11/20/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD]11/23/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD]11/21/2018[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]286[/TD]
[TD]11/20/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD]11/24/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]286[/TD]
[TD]11/20/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD]11/25/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]286[/TD]
[TD]11/20/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD]11/26/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]286[/TD]
[TD]11/20/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD]11/27/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]287[/TD]
[TD]11/20/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD]11/28/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]287[/TD]
[TD]11/20/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD]11/29/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]287[/TD]
[TD]11/20/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD]11/30/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]288[/TD]
[TD]11/20/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD]12/1/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]290[/TD]
[TD]11/20/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD]12/2/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]290[/TD]
[TD]11/20/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD]12/3/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]290[/TD]
[TD]11/20/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD]12/4/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]291[/TD]
[TD]11/20/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD]12/5/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]291[/TD]
[TD]11/20/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD]12/6/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]291[/TD]
[TD]11/20/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD]12/7/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]292[/TD]
[TD]11/20/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD]12/8/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]292[/TD]
[TD]11/20/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD]12/9/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]292[/TD]
[TD]11/20/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD]12/10/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]293[/TD]
[TD]11/20/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD]12/11/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]293[/TD]
[TD]11/20/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD]12/12/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]293[/TD]
[TD]11/20/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]293[/TD]
[TD]11/20/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]293[/TD]
[TD]11/20/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]294[/TD]
[TD]11/20/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]294[/TD]
[TD]11/20/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]294[/TD]
[TD]11/20/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]297[/TD]
[TD]11/20/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]297[/TD]
[TD]11/20/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]297[/TD]
[TD]11/20/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]297[/TD]
[TD]11/20/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]298[/TD]
[TD]11/21/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]298[/TD]
[TD]11/21/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]298[/TD]
[TD]11/21/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]299[/TD]
[TD]11/21/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]299[/TD]
[TD]11/21/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]299[/TD]
[TD]11/21/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]299[/TD]
[TD]11/21/2018[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Please check if this works.


Excel 2013/2016
ABCD
1IDCreation TimeCalendarDistinct ID's count
228511/20/201811/20/201810
328511/20/201811/21/20182
Sheet1
Cell Formulas
RangeFormula
D2{=SUM(IF(C2=$B$2:$B$41, 1/(COUNTIFS($B$2:$B$41, C2, $A$2:$A$41, $A$2:$A$41)), 0))}
D3{=SUM(IF(C3=$B$2:$B$41, 1/(COUNTIFS($B$2:$B$41, C3, $A$2:$A$41, $A$2:$A$41)), 0))}
Press CTRL+SHIFT+ENTER to enter array formulas.


Press Ctrl+Shift+Enter to enter this formula.

Muz
 
Upvote 0
Hi, Just another option (without CSE) to put in D2 and copying it down:

Code:
=SUMPRODUCT((MATCH($A$2:$A$41,$A$2:$A$41,0)=(ROW($A$2:$A$41)-ROW($A$2)+1))*($B$2:$B$41=$C2))
 
Last edited:
Upvote 0
Hi, Just another option (without CSE) to put in D2 and copying it down:

Code:
=SUMPRODUCT((MATCH($A$2:$A$41,$A$2:$A$41,0)=(ROW($A$2:$A$41)-ROW($A$2)+1))*($B$2:$B$41=$C2))


It worked like a charm, thank you.. Aryatect.

what if in case my range is dynamic ? say A2:i, B2:j
 
Upvote 0
Never mind, I fixed the formula the way i needed. thanks much again both of you..

=SUMPRODUCT((MATCH(INDIRECT("A"&SUM(1,1)&":A"&(COUNTA($A:$A))),INDIRECT("A"&SUM(1,1)&":A"&(COUNTA($A:$A))),0)=(ROW(INDIRECT("A"&SUM(1,1)&":A"&(COUNTA($A:$A))))-ROW($A$2)+1))*(INDIRECT("G"&SUM(1,1)&":G"&(COUNTA($A:$A)))=$Q2))
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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