Home > Software engineering >  How to Query function for multiple counts
How to Query function for multiple counts

Time:12-21

I have a Google sheet being used as a property index which has a list of property with its summary details such as location, type, number of bedrooms etc.

I'm trying to count the number of how many 1 bedroom, 2 bedroom, 3 bedroom properties etc there are in each location.

However, I'm not sure how to do multiple counts, for example where column W = 1 and (next column) where W = 2 etc

=QUERY(Property_Location_Type,"select T, count(T) where W='1' Group by T",1)

enter image description here enter image description here

CodePudding user response:

you could try something alike:

formula in cell Y1 here:

=ARRAYFORMULA(QUERY({T2:T,TO_TEXT(IF(W2:W>2,">2",W2:W))&{"",""}},"Select Col1, Count(Col2) Where Col1!='' group by Col1 PIVOT Col3 label Col1 'Town/City'"))

-

enter image description here

  • Related