Search code examples
excelgoogle-sheetsgoogle-sheets-formulacountifsumifs

Google Sheets Get Count and Sum for a specific range of cells as per condition


I have a set of data in Google Sheet as shown below:

Row No. A B C D
- Count Person Name Date Status
1 163 ABC 03-07-2021 1. Done
2 26 ABC 03-07-2021 2. In Progress
3 35 ABC 03-07-2021 2. In Progress
4 21 XYZ 03-07-2021 1. Done
5 0 XYZ 03-07-2021 1. Done
6 17 ABC 04-07-2021 1. Done
7 0 ABC 04-07-2021 1. Done
8 267 ABC 04-07-2021 1. Done
9 29 XYZ 04-07-2021 2. In Progress
10 42 XYZ 04-07-2021 1. Done

And for these data, I want a tracker which shows all the people in Columns with all dates in Rows (because dates we have to add each day) alongwith the sum of the Count column for each date from the above data and only for ones which are marked "1. Done". So I prepared this tracker and following is the result which is needed as per the data above:

Row No. A B
Date ABC XYZ
03-07-2021 163 21
04-07-2021 284 42

I am just aware that both COUNTIF and SUMIF need to be used to achieve this however not sure how to combine both. Need help to formulate it.

Thanks in advance!

(Sorry, Edited to show Row and Column references )


Solution

  • try:

    =QUERY(A:D, "select C,sum(A) where D starts with '1' group by C pivot B", 1)
    

    enter image description here