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.
Related
I have a googlesheet (sheet 1) which looks like this:
contents contains a column with Months
May 2021
June 2021
July 2021
August 2021
September 2021
October 2021
November 2021
December 2021
January 2022
February 2022
March 2022
April 2022
May 2022
June 2022
Each month / cell in column A (sheet 1) all link to another sheet within the workbook containing the data for each month, all data has different rows, so to summarise each month, I want a formula like this:
=sumif(indirect(A4,&"!A:A"),"ProductA",(indirect(A&"!B:B")))
where A4 references January 2021, and this is linked to sheet January 2021, ProductA is in column A of each monthly breakdown (all sheets after sheet 1), and the number of these in column B.
I want to be able to drag this formula down, and have the sheet look for the sum of ProductA across all months, using Column A in sheet 1 to reference the sheet it should look in, i.e. the month.
Does this make any sense?
I can add more info, apologies for the waffle.
Sheet 2 for example contains Month1 data and looks like this:
Category (Ticket) Count Thread Time
prod1 5 22 8395:35:00
prod2 67 5411 644:24:00
prod3 544 55 18283:24:00
prod4 56 546546 97093:52:00
prod5 75 646 38238:11:00
Here is a formula that should work for you:
=arrayformula(sumif(indirect($A2&"!A:A"),C$1,(indirect($A2&"!B:B"))))
You can place this into cell C2, and then copy it down and across.
The issue with your formula was first that you had (indirect(A&"!B:B")), instead of (indirect(A2&"!B:B")).
Secondly, you need to make sure that there's no extra space after your values.
In the above image, you have an extra space after prod3, so when using the SUMIF and trying to match the value, it was not working. If something is resulting in 0 where it shouldn't be, make sure to check that first. I have found that prod4 and prod6 both have the same issue.
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
I want to count say how many Mondays we have from 2022-02-01 - 2022-03-01. I found smth like this:
=SUMPRODUCT(WEEKDAY(B4:C4)=2) - B4 and C4 are the dates
But it returns 0. I assume it only checks if specific date is the specific day. Any ideas how I can do this but for a date range? So how count how many Mondays there are in February
I also found this
=NETWORKDAYS.INTL(B4;C4;"1000000")
but this returns 25
You can take advantage of the NETWORKDAYS.INTL function by using the string method to make all the days as weekend except for Monday.
The String method states:
weekends can be specified using seven 0’s and 1’s, where the first number in the set represents Monday and the last number is for Sunday. A zero means that the day is a work day, a 1 means that the day is a weekend. For example, “0000011” would mean Saturday and Sunday are weekends.
In this case since you only want to know the Mondays, the string would be "0111111" and the function would look like:
=NETWORKDAYS.INTL(StartDate,EndDate,"0111111")
I think this is right. It's counting inclusively so you would get five Mondays starting on Monday 7th Feb 2022 and ended on Monday 7th March 2022 for example.
=floor((B2-(A2+7-weekday(A2,12)))/7)+1
where A2 and B2 contain the start date end end date.
Obvs nul points for me again but for the record this could be generalised if you put the day number in C2 (e.g. 1 if you want to find Sundays, 2 for Mondays):
=floor((B2-(A2+7-weekday(A2,10+C2)))/7)+1
so I have this query that pulls all the data from the previous month but I would like it to pull the previous 6 months
=query(Insiders!A4:L,"Select * where month(C)=month(now())-1",1)
Taking the current month as July, if you want to display results where the date in Col C is in Jan 2021 to June 2021 inclusive, then try this:
=arrayformula(query(Insiders!A4:L,"Select * where C>= date '"&text(eomonth(today(),-7)+1,"yyyy-mm-dd")&"' and C< date '"&text(eomonth(today(),-1)+1,"yyyy-mm-dd")&"' ",1))
Currently (at 10/7/2021), text(eomonth(today(),-7)+1,"yyyy-mm-dd") = 2021-01-01
text(eomonth(today(),-1)+1,"yyyy-mm-dd") = 2021-07-01
These are the two date search ranges.
You can alter the eomonth() function parameters -7 and -1 to move the months into a different period.
try:
=QUERY(Insiders!A4:L, "where month(C)+1="&MONTH(TODAY()), 1)
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))