Search code examples
google-sheetsgoogle-sheets-formula

Google Sheet Query + Countif + Condition Question


I want to populate how many counts that the company appeared on specific week of the month and I'm having difficulty for that. I'm sorry.

I want to populate how many times each companies occurred or counted depending on the week chosen in the dashboard sheet. I'm sorry english is not my first language.

I use query formula to list and count each companies but when changing the week it does not factor my query I'm unsure what to do.

I was able to do array formula on the right part of the sheet once you've checked the link below but I think it will factor out if 2 companies have the same highest count as it will only output 1 text which is why I have thought of using query to list all companies and how many times they count depending on week chosen but seems the query that I have inputted populates all the data that is in the Dashboard sheet.

I hope someone can help me.

Here is my demo sheet https://docs.google.com/spreadsheets/d/1zMoWww9sGxyIC7LLJWBsNRMXN8a7mme1RCT2_IYIXCM/edit#gid=1696267131


Solution

  • You are almost there. You just need to add week column in where clause. I have added that to your sheet. Try this-

    =QUERY(Database!$B:$F,"select B, count(B) 
    where F=" & C5 &" 
    group by B 
    order by count(B) DESC 
    label B 'List of Companies', count(B) 'Counts'",-1)
    

    enter image description here