Google Sheet: break transpose to the next row - google-sheets

Beginning from the date on the right corner of the table, I need to automatically fill the days of the calendar.
Is it possible to transpose until a given cell and break it to the next row?
2/2/2022
sun
mon
tue
wed
thu
fri
2
3
4
5
6
7
8
9
...
=Arrayformula ( Transpose( AND WHAT?)

Related

Google Sheets - Formula to reference next cell in same row

I have two columns where I cam looking up a value in another sheet for date and value. The values are in rows and I want to display the results in columns.
How the source data looks
How I'm pulling it
I can't figure how to make the formula drag down where Column value changes, but the Row value stays the same. Meaning, AA1 would drag down to AB1, AC1, etc.
105 Weds Feb 1 at 9:00 AM
101 Weds Feb 1 at 12:00 PM
115 Weds Feb 1 at 4:05 PM
111 Weds Feb 1 at 9:40 PM
116 Thurs Feb 2 at 12:05 AM
97 Thurs Feb 2 at 1:20 PM
='Data'!B1 ='Data'!B3
='Data'!C1 ='Data'!C3
='Data'!D1 ='Data'!D3
I've tried using an array and it works for the displaying the next value in the Column, but not the next value in the Row like I want.
I've also tried some scripts I was able to lookup but wasn't successful.

How tranpose the data of more than 1 cell to only 1 cell on google sheets?

I have the following column :
A1
Miu Kei Yuk
3354
of
2018
8 April 2022
and need to separate it into 3 columns :
3354 of 2018 Miu Kei Yuk 8 April 2022
So the first and the fifth row are correct, but the row number 2, 3 and 4 needs to be in only 1 cell.
I tried transpose(A1:A5) but iu results in :
Miu Kei Yuk domingo, março 07, 1909 of 2018 8 April 2022
Is it possible to do it ?
try:
={A2&" "&A3&" "&A4, A1, A5}
or:
={A2&" "&A3&" "&A4\ A1\ A5}
For Portuguese Locale use this formula or Make a copy of this example.
={TEXTJOIN(" ";1;A2:A4)\
A1\
A5}
For United States locale use this formula
={TEXTJOIN(" ",1,A2:A4),
A1,
A5}

google sheets query filter by datediff is this possible?

So i use the following formula:
query(OVERVIEW!$B$11:$W;"Select B,C,D,I,G,H,K where month(C)="&0+$D$11&"and W matches '"&IF($B$10=TRUE;"CREATE PO";"")&"' Order by "&$B$3&"")
and what it does it checks in which month you are looking and based on the forecast it will check a couple of months and return the result in the table.
So for this example, lets say I have 12 monthly tables
Jan Feb Mar Apr Mei Jun Jul Aug Sep Okt Nov Dec
I want data to be filled under each table + forecast of 3 months
So in Jan, I get Mar orders for example. this works as it is now but if go to let's say
Okt it should give me 3 months later data so in Jan next year only the formula I have does it for this year only and if I remove the year part I get both years Jan and that is not what I want. it should count furter so Dec 2021 + 3 months will be Marth 2022.
Any pointers?
I was thinking something with Datediff en EOMONTH() functions??
Example what needs to be
UPDATE: Link to file:https://docs.google.com/spreadsheets/d/1ti7TdF2mWEGxA1E4FIeNJ7sEEtYTgu4UQtMxYqS7ets/edit?usp=sharing
Update I have created a working example in the second tab with the
following formula:
=IFERROR(QUERY(C4:C22,"select * where C >= date '"&TEXT(DATEVALUE(EOMONTH("01-01-"&E1,D1-1)+1),"yyyy-mm-dd")&"'and C <= date '"&TEXT(DATEVALUE(EOMONTH("01-01-"&E1,D1)),"yyyy-mm-dd")&"'"))
i do not know if this is the best solution but it works XD
=IFERROR(QUERY(C4:C22,"select * where C >= date '"&TEXT(DATEVALUE(EOMONTH("01-01-"&E1,D1-1)+1),"yyyy-mm-dd")&"'and C <= date '"&TEXT(DATEVALUE(EOMONTH("01-01-"&E1,D1)),"yyyy-mm-dd")&"'"))
pasting the above code in each colum and change the month to the same month you need for example Feb is "01-02"

Google sheets query returning incorrect date

I have a got a query where I'm trying to pull in the next 14 days events and previous 14 days events
For some reason, I'm getting very dates added which are in the past or way into the future
=QUERY(Sheet1!A2:H200,"select A,B,G where dateDiff(now(), G) <14 and G is not null")
ABC 1 15 Feb 2019
ABC 1 1 Nov 2018
DFG 1 11 Nov 2018
ABC 1 2 Nov 2018
Next is the previous 14 days
=QUERY(Sheet1!A:G,"select A,B,G where dateDiff(now(), G) >14 and G is not null")
ABC 1 20 Oct 2018
ABC 1 20 Oct 2018
I'm doing something wrong with the query
https://docs.google.com/spreadsheets/d/1WI-FS0XFGi09d2wO005S3kOV_L2s9eR3ILxST6I1nVU/edit?usp=sharing
If you wanted to do it all using datediff, it would be
=query(A:C,"select A,B,C where datediff(C,now())<14 and datediff(C,now())>0")
for dates in next fortnight (fourteen nights or 2 weeks) and
=query(A:C,"select A,B,C where datediff(now(),C)<14 and datediff(now(),C)>0")
for previous fortnight.
You might want to put <= and >=, depending whether you want to include today's date and date 14 days before/after today.
When you use less than 14, Future dates are also included because datediff returns a negative number. So, add a another condition to exclude future dates like:
=QUERY(A:C,"select A,B,C where dateDiff(now(), C) <14 and C<now() and C is not null")

Transpose and repeat column

I know this might be a long shot but here it goes:
Let's assume I have this data:
A B
2014 1
2015 2
2016 3
2017 4
2018
Those columns are not related. But based on that I would like to create a table like this:
2014 2014 2014 2014 2015 2015 2015 2015 2016 2016 2016 2016
1 2 3 4 1 2 3 4 1 2 3 4
Or even better have each column repeated 5 times. What I want to achieve i that I will have data for each year and quarter, and then I would like to display each quarter separately and at the end of each year to have an average:
2014 2014 2014 2014 2014 2015 2015 2015 2015 2015 2016 2016 2016 2016 2016
1 2 3 4 avg 1 2 3 4 avg 1 2 3 4 avg
I've used TRANSPOSE(A2:B6) but I'm stuck on the repetition side of things, if it's even possible
Since I have data in a first column, perhaps something like this is easier to achieve:
A B C D
2014 2015
Label A 1 x x
Label A 2 x x
Label A 3
Label A 4
Label B 1
The labels in A column are taken using QUERY, just a list of, for example, people - can I repeat them? The Xs would then be a singular query to get right data for column A,B, and C
There is rept for repeating a string a given number of times. It can be abused for other data by way of join and split, if you can pick a suitable delimiter (some character that isn't going to be present in the data). I use | as a delimiter:
=split(join("", arrayformula(rept(A2:A6 & "|", 5))), "|")
This puts the content of A2:A6 in a row, repeating each entry 5 times.
Similar trick to have the content of B2:B6 repeated but in a loop: 1, 2, 3, 4, avg, 1, 2, 3, 4, avg ... :
=split(rept(join("|", B2:B6), 7), "|")
Here 7 is the number of times the loop should be repeated.

Resources