Have only Tuesdays and Fridays repeating - google-sheets

Is it possible to drag a repeating pattern of Tuesdays and Fridays repeating in Google Sheets? The type of output I'm looking for would be this:
Tuesday, June 2, 2015
Friday, June 5, 2015
Tuesday, June 9, 2015
Friday, June 12, 2015
...
and then drag down to continue the pattern...
When I do it now, it continues incrementing by he number of days between Tuesday and Friday.
Thanks!

Maybe you can try a formula:
=query(ArrayFormula({(date(2015,6,2)+row(A1:A1000)-1), weekday(date(2015,6,2)+row(A1:A1000)-1,2)}), "select Col1 where Col2 matches '"&JOIN("|", 2, 5)&"' limit 10")
where the date() function holds the starting date
and the limit part limits the output to whatever number you want.
See if that works ?
EDIT: If you only want the tuesdays and fridays from the list of dates in col A, try:
=filter(A2:A, (WEEKDAY(A2:A)=3)+(WEEKDAY(A2:A)=6))
Then copy the output and paste in col A as 'values only'.

Related

Combine and transpose

I have a table that looks like this:
Year
Month
Customers
Country
2022
January
12
Argentina
2022
January
4
Australia
2022
January
6
Brazil
2021
December
8
Argentina
2021
December
4
Australia
2021
December
2
Brazil
2021
November
12
Argentina
2021
November
4
Australia
2021
November
14
Brazil
I want to consolidate the year and month columns, and transpose the rest of the data for a result that looks like this:
Year
Month
Argentina
Australia
Brazil
2022
January
12
4
6
2021
December
8
4
2
2021
November
12
4
14
Is there any way to do this in Google Sheets?
Try below QUERY() function.
=QUERY(A1:D10,"select A, B, min(C) group by A,B pivot D order by A DESC")
Use this formula
=QUERY(QUERY({A1:D}, " Select * Where Col1 is not null "),
"Select Col1, Col2, min(Col3) group by Col1,Col2 pivot Col4 order by Col1 Desc")

(Google Sheets) How to Find the Day With the Most Wins/Losses

I am building a personal trading journal with a very limited knowledge of spreadsheets formula, and decided to ask here after several failed attempts.
I want to achieve this:
Trade Result (column A)
Trading Day (column B)
Win
Monday
Loss
Tuesday
Win
Monday
Win
Tuesday
Loss
Wednesday
Loss
Wednesday
Win
Monday
Win
Monday
Loss
Friday
From above, we know that the day with the most wins: Monday.
Day with the most losses: Wednesday
How do I achieve that Monday for the day with the most wins, and Wednesday for the day with the most losses?
Appreciate the help. Thank you very much.
Try below formula-
=INDEX(SORT(({$B$2:$B$10,COUNTIFS($B$2:$B$10,$B$2:$B$10,$A$2:$A$10,C3)}),2,0),1,1)
use:
=ARRAY_CONSTRAIN(SORTN(QUERY({A:B},
"select Col1,Col2,count(Col2)
where Col1 is not null
group by Col1,Col2
order by count(Col2) desc
label count(Col2)''"), 9^9, 2, 1, 0), 9^9, 2)

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.

Google sheets previous 6 months data query

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)

ArrayFormula Output Ordering

I am trying to take the output of the ArrayFormula in the top answer of this previous question, where the output is days of the week, and I want to output them in the proper order (Sunday, Monday, ..., Saturday).
Currently, when I use this formula I get the order Friday, Monday, Saturday, Sunday, Thursday, Tuesday, Wednesday. I have tried using the "order by" clause listing the days of the week in order order by("Sunday", "Monday", ..., "Saturday" without success.
My formula right now is =QUERY({H:H,H:H},"select Col1, count(Col2) where Col1 != '' group by Col1 label count(Col2) 'Number of Calls'",1).
A sanitized version of the data I am attempting to use is here. This data is over the course of one year. It has also been edited to include the two solutions I have so far for reference of future viewers.
Is it currently possible to do the ordering of the days within the Query? If not, what is the best way of going about getting the correct order.
I can't edit your sheet, but this is what I suggest. I don't understand why you have columns D-G, but I will assume you have a reason and work with what you have. First, change H2 to =weekday(F2) and copy it down to H66 (last row). This will return the number of the day of the week (Sunday=1, Monday=2...Saturday=7). Then in I2-I8 fill in the days of the week in the order Sunday through Saturday. In J2 put:
=COUNTIF($H$2:H,"=1")
for Sunday. In J3 put:
=COUNTIF($H$2:H,"=2")
for Monday. And so on through Saturday. That should do it.

Resources