Home > OS >  Unique number of dates for certain criteria
Unique number of dates for certain criteria

Time:10-07

In the below screenshot I would like to get column E as my output. I need the unique number of dates where campaign/Ad group budget (col D) = campaign name (col B)

I tried using the following query "query(A2:E9,"select A, count(A) where E=B group by A")" and iterating it using Apps Script for loop. However, that did not work.

Is there any other way to find this output?

enter image description here

CodePudding user response:

I think this formula will get you both the date and the count that are unique.

=unique(filter({A:A,E:E},B:B=D:D,B:B<>""))

enter image description here

You could then leverage an index function to get just on column. So this would give you just the count:

=Index(unique(filter({A:A,E:E},B:B=D:D,B:B<>"")),,2)

while this would get you the date

=Index(unique(filter({A:A,E:E},B:B=D:D,B:B<>"")),,1)

CodePudding user response:

try:

=QUERY(A2:E9, "select A,count(A) where D=B group by A")
  • Related