Thursday, January 31, 2013

yogi_Do MultiConditional Count Using Alernate Formulations Using Functions Such As QUERY FILTER SUM COUNTA


                                          Google Spreadsheet   Post  #1001
Yogi Anand, D.Eng, P.E.      ANAND Enterprises LLC -- Rochester Hills MI     www.energyefficientbuild.com.    Jan 31, 2013
post by user: Koala Yeung said:(http://productforums.google.com/forum/?zx=7oinkl81cee#!category-topic/docs/spreadsheets/qzMH8c6JTvU)
How to change this select query into a count query? 
Hi all,

I've just wrote a query like this:
=QUERY(Guests!$A$1:$D$300, "SELECT C WHERE A='"&A2&"' AND B='"&B2&"' AND D!='No'")

It returns 3 rows of results that fits the requirement.
Is there anyway I can change this query so it can give me the count number (3) instead of the 3 rows?

Thanks.

---
I tried this one
=QUERY(Guests!$A$1:$D$300, "SELECT COUNT(C) WHERE A='"&A2&"' AND B='"&B2&"' AND D!='No'")

It doesn't work the way I want.
Instead of a 1 cell result, it gives me 2. One of them says "count" and the other one says "3".

So is there anyway to achieve the result I need?

------------------------------------------------------------------------------------------
following is a solution to the problem