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.

idcreation timeCalendar
28511/20/201811/20/2018Output
28511/20/201811/21/2018Calendar dateDistinct ID's count
28611/20/201811/22/201811/20/201810
28611/20/201811/23/201811/21/20182
28611/20/201811/24/2018
28611/20/201811/25/2018
28611/20/201811/26/2018
28611/20/201811/27/2018
28711/20/201811/28/2018
28711/20/201811/29/2018
28711/20/201811/30/2018
28811/20/201812/1/2018
29011/20/201812/2/2018
29011/20/201812/3/2018
29011/20/201812/4/2018
29111/20/201812/5/2018
29111/20/201812/6/2018
29111/20/201812/7/2018
29211/20/201812/8/2018
29211/20/201812/9/2018
29211/20/201812/10/2018
29311/20/201812/11/2018
29311/20/201812/12/2018
29311/20/2018
29311/20/2018
29311/20/2018
29411/20/2018
29411/20/2018
29411/20/2018
29711/20/2018
29711/20/2018
29711/20/2018
29711/20/2018
29811/21/2018
29811/21/2018
29811/21/2018
29911/21/2018
29911/21/2018
29911/21/2018
29911/21/2018

<tbody>
</tbody>
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
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
Great, glad could help and thanks for the feedback!
 
Upvote 0

Forum statistics

Threads
1,214,553
Messages
6,120,184
Members
448,949
Latest member
keycalinc

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