select all columns based on a specific row value Google-Sheets - google-sheets

Hi everybody I am trying to query an already formatted google sheets, I am able to filter some of those data (I used =query(x,select * where ... )). The output I get is the following:
may
may
june
june
july
july
july
planned
name
1
0
1
1
2
3
1
Now I want to refer to all the numbers under may (or june or july) in order to do some operation. I can' t just select the value I want because I need to automate it.
How can I get all the columns containing a specific marker(in my case the name of the month)? If it is not possible can you suggest me a different way to do that ? (I am not very experienced with google sheets or excel)

Since query can't select rows, you'd transpose it first and then select the columns you want and then retranspose it back, if needed:
Input:
may
may
june
june
july
july
july
planned
name
1
0
1
1
2
3
1
Formula(select columns >0):
=QUERY(TRANSPOSE(A27:I28),"Select * where Col2>0")
Output:
planned name
may
1
june
1
june
1
july
2
july
3
july
1

Related

Show value if months equals current month

I have a google sheet with monthly targets per product, and in another sheet I want to reference this and only show the target of the current month.
June 2022 July 2022 August 2022
Product 1 50 60 70
Product 2 20 40 60
The formula I tried is:
=IF(MONTH(A1)=MONTH(targets!$B$1:$D$1), targets!B2:D2, "")
Where A1 has =TODAY()
Use FILTER() function.
=FILTER(B2:D3,MONTH(B1:D1)=MONTH(F1))
You could also try
=index(B2:D3,0,match(G1,B1:D1))
But exact match might be safer
=index(B2:D3,0,match(eomonth(G1,-1)+1,B1:D1,0))
in case the required month is missing.

Compare performance range over the years for each unique school

I have a dataset with Year, school_id, Performance range (let's call it P_range).
Years range from 2019 - 2016
Performance Range from 0-5
Over 2000 unique school_ids
Basically I need to know how each school_id perfomed over the years within performance range.
Example:
YEAR
School_ID
P_Range
2019
1
4
2018
1
5
2017
1
3
2016
1
3
2019
2
1
I would like a fourth column that would look at the dataset and tell me in which year did its performance alter
2019-2018 this school decreased the range
2018-2017 this school increased the range
2017-2016 this school maintained the range
2016 would not compare to anything which is "First evaluation"
So at any given time, when we look at the results of 2019 we would see a sum of results being compared to 2018 and so on.
We need to know at a yearly rate, how many "maintained", "decreased" "increased" or "First evaluation"
If it were on excel this would be the formula:
=IF(B2=B3;IF(C2>C3;"INCREASED";IF(C2=C3;"MAINTANED";"DECREASED"));IF(B2<>B3;"1ST EVALUATION"))

Sorting by week in Google Analaytics Sheets add on

I just want to run a simple weekly traffic report with the Google Analytics Sheets add on. It does work fine, but I can't seem to figure out how to sort the weeks in chronological order with the jump from 2019 to 2020.
This is how it looks like
Order of the weeks
Does anybody know what Order I need to enter to have the order from week 38 - 53 and then continue with 1,2...?
Include the year as dimension and order by year and by week, like this:
year week
2019 38
2019 39
2019 40
...
2020 1
2020 2
2020 3
For multi year weekly analysis, it's better to just use the corresponding Mondays for any date for your grouping/summing/analysis than it is to use "Week Numbers"
Those mondays can be obtained by using this arrayformula, assuming your dates were in column A (A2:A)
=ARRAYFORMULA(IF(A2:A="",,FLOOR(A2:A+5,7)-5))

Split revenue by year with Google Sheets' QUERY function

I get monthly revenue data from the finance department that I have clean to input into a reporting format. Its monthly data that lists all revenue in a single column. I need to split out the revenue by years (2018, 2019, etc.).
I believe that I need to use a query function for this but if you have some other solution, then I'm open to that too.
The data looks like this:
Client Source Month Year Revenue
abc Google 1 2019 100
abc Google 1 2018 100
abc Facebook 1 2018 50
abc Facebook 2 2018 50
And I need it to look like this:
Client Source Month 2018 Revenue 2019 Revenue
abc Google 1 100 100
abc Facebook 1 50 0
abc Facebook 2 50 0
I'm familiar with query functions but I can't wrap my head around how to do this.
The pseudo code for this would be something like:
select Client,
Source,
Month,
Case when Year in 2019 then sum(Revenue) as 2019 Revenue else 0 end,
Case when Year in 2018 then sum(Revenue) as 2018 Revenue else 0 end
from Data
Group by Client, Source, Month
Please let me know if I need to provide any additional information. And I appreciate your help with this problem.
=QUERY(A1:E, "select A,B,C,sum(E) where A is not null group by A,B,C pivot D", 1)

Conditional array formulas

I have a massive dataset and am preparing a dashboard based on this dataset.
On my dashboard, I have a drop-down menu that allows me to select a month of my choice, from Jan to Apr.
Visitor Jan Feb Mar Apr
Jenny 2 3 0 1
Peter 2 0 1 3
Charley 0 2 4
Charley 1 2 2 3
Sam 1 4 2 3
Peter 2 2 5 0
John 3 3 6 9
Robin 4 0 7 0
I am looking for a formula that will give me the number of unique visitors who have been active at least once in the month that I choose from the drop-down menu.
Hoping this is really clear, but if not, please feel free to shoot back your questions.
This may be easier with Excel 2013, but if the results you want from your example are 6, 5, 5, and 5 for Jan>April respectively then perhaps:
Create a PivotTable from multiple consolidation ranges (example how here and for VALUES choose Sum of Value.
Count the non-zero values in the PT by column with a formula such as:
=COUNTIF(H5:H10,">"&0)
The above however would not be convenient for repetition each month, though a whole year might be prepared at one time.

Resources