Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

I'm trying to use information from a table to display a count of blank cells based on the type of data in the table. See my example below - I want to count how many of each fruit I'm missing, regardless of their color, and ignoring the apples I do have.

Table:

End result:

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

The following formula will almost retrieve the table you want.

Formula

 QUERY(data, query, headers)

=QUERY(
   DATA!A1:C7,                                         // data
   "SELECT A, COUNT(B) WHERE C IS NULL GROUP BY A      // query
      LABEL COUNT(B) 'Amount of Empty Types'"             
 )

Explained

Column A is selected to be shown. It is not possible, with the QUERY formula, to perform on the same column a count and select operation. Therefore I performed the count on column B. The where clause on column C is set to contain nothing. All results are to be grouped by column A. At the end of the query, the header/label is changed (otherwise it would show "count Color".

Result

enter image description here

Example

I've created an example file for you: Counting blank cells based on information in related cell

share|improve this answer
    
I was so close... That really cleared it up for me thanks so much. –  Tom Dec 4 '13 at 15:31
    
I am getting a strange issue though. The Query works for every sheet except the First sheet. The query of my first sheet is returning all the data except the first 5 lines, and in the cell with the Query formula, it returns the first 4 lines from the Type column on the first sheet. –  Tom Dec 4 '13 at 15:45
    
@Tom Why don't you add me to your file, so that I can have a look.... –  Jacob Jan Tuinstra Dec 4 '13 at 21:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.