Count number of unique values in specified date range:

bentxoxo

New Member
Joined
Jan 13, 2016
Messages
29
Hi


I'm looking to calculate on how many RNA issued in specified month. Please see my example below:



Thanks in advance!


DateRNATOTAL
18/02/201933711RNA
18/02/201933722MonthISSUED
18/02/201933733Feb18
18/02/201933744Mar19
18/02/20193374
18/02/20193374
18/02/20193374
18/02/201933755
18/02/20193375
18/02/201933766
20/02/201933777
20/02/20193377
20/02/201933788
21/02/201933799
21/02/2019338010
22/02/2019338111
22/02/20193381
22/02/20193381
22/02/20193381
22/02/20193381
22/02/20193381
22/02/20193381
22/02/2019338212
26/02/2019338313
27/02/2019338414
28/02/2019338515
28/02/2019338616
28/02/2019338717
28/02/2019338818
1/03/201933891
1/03/201933902
1/03/201933913
1/03/201933924
1/03/201933935
1/03/201933946
6/03/201933957
6/03/201933968
6/03/201933979
6/03/2019339810
8/03/2019339911
8/03/2019340012
8/03/2019340113
8/03/2019340214
8/03/2019400015
15/03/2019400116
15/03/20194001
15/03/20194001
15/03/2019400217
18/03/2019400318
18/03/2019400419
18/03/20194004

<tbody>
</tbody>
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
with PowerQuery aka Get&Transform:

DateRNADateCount
18/02/2019​
3371​
February
18​
18/02/2019​
3372​
March
19​
18/02/2019​
3373​
18/02/2019​
3374​
18/02/2019​
3374​
18/02/2019​
3374​
18/02/2019​
3374​
18/02/2019​
3375​
18/02/2019​
3375​
18/02/2019​
3376​
20/02/2019​
3377​
20/02/2019​
3377​
20/02/2019​
3378​
21/02/2019​
3379​
21/02/2019​
3380​
22/02/2019​
3381​
22/02/2019​
3381​
22/02/2019​
3381​
22/02/2019​
3381​
22/02/2019​
3381​
22/02/2019​
3381​
22/02/2019​
3381​
22/02/2019​
3382​
26/02/2019​
3383​
27/02/2019​
3384​
28/02/2019​
3385​
28/02/2019​
3386​
28/02/2019​
3387​
28/02/2019​
3388​
01/03/2019​
3389​
01/03/2019​
3390​
01/03/2019​
3391​
01/03/2019​
3392​
01/03/2019​
3393​
01/03/2019​
3394​
06/03/2019​
3395​
06/03/2019​
3396​
06/03/2019​
3397​
06/03/2019​
3398​
08/03/2019​
3399​
08/03/2019​
3400​
08/03/2019​
3401​
08/03/2019​
3402​
08/03/2019​
4000​
15/03/2019​
4001​
15/03/2019​
4001​
15/03/2019​
4001​
15/03/2019​
4002​
18/03/2019​
4003​
18/03/2019​
4004​
18/03/2019​
4004​

Code:
[SIZE=1]// Table1
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Month = Table.TransformColumns(Source, {{"Date", each Date.MonthName(_), type text}}),
    RemDup = Table.Distinct(Month),
    Group = Table.Group(RemDup, {"Date"}, {{"Count", each Table.RowCount(_), type number}})
in
    Group[/SIZE]
 
Upvote 0
In H4 control+shift+enter, not just enter, and copy down:

=SUM(IF(FREQUENCY(IF($A$2:$A$52-DAY($A$2:$A$52)+1=(1&F4)+0,$C$2:$C$52),$C$2:$C$52),1))

where F4 = Feb.
 
Upvote 0
Beautiful!

Thanks you so much Sandy666 and Aladin Akyurek.

Both macro and formula worked like charm - Much appreciated!:)
 
Upvote 0
Thanks Sandy666!

How can I add another condition in formula.

Where F4 = FEB and G4 = "1. Pack Damaged on Arrival"

Thanks heaps!
 
Upvote 0
Thanks Sandy666!

How can I add another condition in formula.

Where F4 = FEB and G4 = "1. Pack Damaged on Arrival"

Thanks heaps!

Control+shift+enter, not just enter:

=SUM(IF(FREQUENCY(IF($A$2:$A$52-DAY($A$2:$A$52)+1=(1&F4)+0,IF(DamageRange=G4,$C$2:$C$52)),$C$2:$C$52),1))
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,806
Members
449,048
Latest member
greyangel23

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