COUNTUNIQUEIFS with two criterion - google-sheets

Can anyone please help me figure out the right formula for the below problem?
I want a count without"sample"
The right answer is 3 but formula return 4
enter image description here
=COUNTUNIQUEIFS('PD01'!B2:B17,'PD01'!C2:C17,"PD01",D2:D17,"NEW",'PD01'!A2:A17,J2)+COUNTUNIQUEIFS('PD01'!B2:B17,'PD01'!C2:C17,"PD01",D2:D17,"",'PD01'!A2:A17,J2)
Thanks a lot
Link spreadsheet
https://docs.google.com/spreadsheets/d/1OTLcaJybrTvlWpwVy03a3cUeN1jPL9ZsYa7m8PddZ-U/edit#gid=0

See if this helps
=countunique(query(A:D, "Select B where A = date '"&TEXT(F2, "yyyy-mm-dd")&"' and C = '"&G2&"' and D matches '^(NEW|)$'", 0))

Related

Query and sum in Google Sheet

Hello I need help in creating a formula with query and sum in google sheet
Here are the condition:
count of all(Column A= a certain number or a specific cell) and Column E=either of the states-up to 4 state
Hope someone can assist me on this.
try:
=QUERY(A2:E, "select E,sum(A) where A is not null group by E label sum(A)''")

QUERY and Counta

Here I am again, asking amateur questions. Hope you guys able to help out. What I want to accomplish here is to use query formula to select unique in Col A and after that to count each categories respectively. As I want to make this dynamic, I also to able to further filter based on the criteria in I2 and I3.
Here is the link to the trix link
use:
=QUERY(A4:C,
"select A,count(A)
where C = '"&I3&"'
and B = '"&I2&"' group by A
label count(A)''")
btw, those are not dates. you can check it with ISDATE() function

SUM function works fine in one sheet, but not the other?

I asked this before but I can't for the life of me find that question, so I just have to assume it dissolved into the ether.
I have this SUM function =SUM(QUERY($A$1:$B, "SELECT B WHERE A = '" & "s" & "'", 0)) that works just fine when used on one sheet, but not on another sheet in the same spreadsheet. In the other spreadsheet, it returns a zero rather than the total that it's supposed to. Through some experimenting, I've found that reducing the query search range seems to fix the problem, but that is unhelpful to me as the new range is smaller than what I need. If anyone knows anything about this or any possible fixes, some help would be super appreciated!
Here is a copy of the spreadsheet in question, all cells containing the formula are highlighted yellow: https://docs.google.com/spreadsheets/d/1bNmDYdUw-FU4wWTShV1cijtOt9l7McvktgAoDELbwQ8/edit?usp=sharing
If any more info is needed feel free to ask! Thank you!
Problem is in your K Column formula. The formula returning text instead of numeric number which causing trouble QUERY() formula. Change this formula =IF((E2*F2*H2)>0, Roundup(((E2/F2)+(E2/H2))/2, 3), "-") to
=IF((E2*F2*H2)>0, Roundup(((E2/F2)+(E2/H2))/2, 3), 0)
You can directly use avg() function to query formula to get average. Try-
=QUERY($B$2:$M, "SELECT avg(K) WHERE B = 's' label avg(K) ''", 0)
use:
="Average: "&AVERAGEIF(B2:B, "s", K2:K)

ARRAYFORMULA FILTER VLOOKUP solution for multiple condition formula Google sheets

I need an ARRAYFORMULA, VLOOKUP or FILTER formula in K7 that:
Puts the date from A7:A IF the value in J7:J is >= E7:E AND <= F7:F AND D7:D = "Traverse"
I have got multiple solutions to work on the individual rows, but none to work as an array formula to effect the entire column.
=IF(AND(J7>=E7:E,J7<=F7:F,D7:D="Traverse"),OFFSET(J7,0,-9),"")
or
=IFERROR(FILTER(A:A,E:E<=J7,F:F>=J7,D:D="Traverse"))
or
=ArrayFormula(IFNA(vlookup(J7:J2064,Query(sort(filter({date("20"&left(A7:A,2),mid(A7:A,3,2),right(A7:A,2)),A7:G},D7:D="Traverse"),6,1,1,0),"Select Col6,Col2",0),2,1)))
an example sheet is here if anyone can shed any light :)
https://docs.google.com/spreadsheets/d/1SYbhfyIA2KoZF0k-TuIqm-Kn9L9o0I16EGbSXDaTABU/edit?usp=sharing
use:
=ARRAYFORMULA(IF((J7:J>=E7:E)*(J7:J<=F7:F)*(D7:D="Traverse"), A7:A, ))
update:
=ARRAYFORMULA(IFNA(VLOOKUP(J7:J, SORT({
FILTER({E7:E, A7:A}, D7:D="Traverse");
FILTER({F7:F+1,H7:H}, D7:D="Traverse")}), 2, 1)))
Thanks for your help, in the end I managed to get a formula working from someone on the Google help forum. This is a working solution if you're interested:
=ArrayFormula(IFNA(vlookup(J7:J,sort({filter({Register!E7:F,Register!A7:A},Register!D7:D="Traverse")
;if({index(sort(filter({Register!A7:A,Register!E7:E,Register!F7:F},Register!D7:D="Traverse"),2,1),0,2);""}
>{"";index(sort(filter({Register!A7:A,Register!E7:E,Register!F7:F},Register!D7:D="Traverse"),2,1),0,3)},
{{"";index(sort(filter({Register!A7:A,Register!E7:E,Register!F7:F},Register!D7:D="Traverse"),2,1),0,3)}+1,
{index(sort(filter({Register!A7:A,Register!E7:E,Register!F7:F},Register!D7:D="Traverse"),2,1),0,2);""},
iferror({index(sort(filter({Register!A7:A,Register!E7:E,Register!F7:F},Register!D7:D="Traverse"),2,1),0,2)
;""}/0,"")},)},1,1),3,1)))

How to make these 3 tables communicate with each other on Google Sheets?

On the sheet with the link below, I need to do this:
In the case x exists on A and C rows, not on B row > total grade (on table 3) of x should be calculated as 10 (A+B from table 2)
And same for y and z.
https://docs.google.com/spreadsheets/d/1QW9Ansn0n4NgTkLFnKjr64xEK2JCR-6KTZWe-LKAqBc/edit#gid=0
I couldn't find a way to do this with sumif or hlookup etc.
Could you please help me solve this? It's very crucial task for my team.
Thanks in advance
I added this formula to cell B15 of the sheet and copied it down:
=SUM(ArrayFormula(IF($B$3:$C$5=$A15;vlookup($A$3:$A$5;$A$9:$B$11;2;0))))

Resources