I have a simple formula I want to perform in the same column.
Link to sheet
Column A: dates
Column C: multiplier
Column B: where I want to perform the formula.
B2 = B1-B1*$C$1
B3 = B2-B2*$C$1 etc
I'd like to automatically run the formula as the number of months (in Col A) changes.
A
B
C
1/4/22
100
0.5
1/5/22
50
1/6/22
25
try:
=ARRAYFORMULA(IF(A2:A="",,B1*C1^SEQUENCE(COUNTA(A2:A))))
=arrayformula( B1 * (1 - C1) ^ sequence(count(A2:A)) )
Related
This is my Items sheet
And this is my Values sheet
As can be seen from the table, alfa is associated with 20 40 60 80, beta with 30 40 70 80 and gamma with 50 60 70 80.
In the Items sheet in cell B1 (next to the first item) I would like a formula (Arrayformula or alike) generating the average value for each item. In my example it should be:
alfa -> 50 (that is: (20+40+60+80)/4 = 200/4)
beta -> 55 (that is: (30+40+70+80)/4 = 220/4)
gamma-> 65 (that is: (50+60+70+80)/4 = 260/4)
So the final result should be:
This is my googlesheet: example
P.S. For simplicity's sake, I used just columns A:C for items in Values sheet. In real case I have 10 columns so I want to avoid to specify each one in the formula and instead use a range.
try:
=BYROW(A1:A3, LAMBDA(x, INDEX(QUERY(SPLIT(FLATTEN(Values!A1:C10&""&Values!D1:D10), ""),
"select avg(Col2) where Col1 = '"&x&"'"), 2)))
update
=IFERROR(BYROW(A1:INDEX(A:A, MAX(ROW(A:A)*(A:A<>""))),
LAMBDA(x, INDEX(QUERY(SPLIT(FLATTEN(
FILTER(Values!A:C, Values!D:D<>"")&""&
FILTER(Values!D:D, Values!D:D<>"")), ""),
"select avg(Col2) where Col1 = '"&x&"'"), 2))))
For this sample table:
A
B
C
D
E
1
Range!A1:C5
URL1
= Formula here
2
URL2
3
URL3
4
...
I have this working formula in C1:
={IMPORTRANGE(B1, A1); IMPORTRANGE(B2, A1); IMPORTRANGE(B3, A1)}
A1 contains the range to pull from the target Sheets.
Links to the target Sheets are found in column B.
(This is a simplified example. My actual Sheet has 21 entries in column B.)
Question:
If I will have to add/remove URLs in column B, I have to adjust the formula in C1 and add/remove IMPORTRANGEs.
I would like to have a formula that automatically adjusts to the entries in column B.
Solutions tried:
I tried this, but it did not work:
={JOIN("", ARRAYFORMULA(IF(LEN(B1:B), "IMPORTRANGE(""" & B1:B & """, """ & A1 & """); ", "")))}
The JOIN function returns a text that should be identical to what the array { ... } parses as a formula. But it doesn't. Wrapping it with INDIRECT also does not work.
Any suggestions on how I could make this work?
if by "working formula" you mean valid formula that returns data then only thing you can do is hardcode it like this:
=QUERY({
IFERROR(IMPORTRANGE(B1, A1), {"","",""});
IFERROR(IMPORTRANGE(B2, A1), {"","",""});
IFERROR(IMPORTRANGE(B3, A1), {"","",""})},
"where Col1 is not null", )
A1:C5 = 3 columns = {"","",""}
you can generate formula dynamically with arrayformula but the result will be always a text string and not active formula. tho if you wanna go this way you will need a script that will convert your text string into active formula. example:
https://stackoverflow.com/a/73119313/5632629
https://stackoverflow.com/a/61819704/5632629
Given two sheets that look like this:
Sheet1
a1 b1
a1 b1
Sheet2
a2 b2
a2 b2
a2 b2
How could I query for both sheets and combine all the rows together to get something line
Combined
a1 b1
a1 b1
a2 b2
a2 b2
a2 b2
I have tried the following but none of them worked
={QUERY({'Sheet1'!A1:B},"select *");QUERY({'Sheet2'!A1:B},"select *")}
=QUERY({'Sheet1'!A1:B;'Sheet2'!A1:B},"select *")
The problem with both is that I don't specify what row to end at for the two sheets. If I changed it to =QUERY({'Sheet1'!A1:B2;'Sheet2'!A1:B3},"select *"), then it would work. The problem with this is that in my actual spreadsheet, the number of rows in the sheets is changing as I am inputting more data and I would rather not have to update the query everytime.
You were close. Include the full possible ranges and add a bit to the "Select" clause:
=QUERY({Sheet1!A:B;Sheet2!A:B},"Select * Where Col1 Is Not Null")
This returns only the non-null (i.e., existing) data from each sheet.
I need a formula for cell B2 in Sheet1 which will calculate the total value of column B in Sheet2 where the value of column A in Sheet2 matches any URL's in columns C to E in Sheet1.
For example B2 in Sheet1 would total 43 (32 + 9 + 2 from B2 + B4 + B6 in Sheet2), B3 would total 4, B5 would total 4 etc etc.
Note: Sheet1 may sometimes have URL's in
Sheet1
Sheet2
paste in Sheet1!B2 and drag down:
=SUM(ARRAYFORMULA(IFERROR(VLOOKUP(TRANSPOSE(C2:2), Sheet2!A$2:B, 2, 0))))
I've been using the following function:
=query(Sheet1!A2:D," select A, B, C where A matches '"&JOIN("|", A2:A)&"' and D matches 'yes'")
Is there anyway that I can make is so that every row that starts with a match will be added a comma separated list in which each column occupies one cell with no duplicates as shown in sheet3.
https://docs.google.com/spreadsheets/d/1YDxIUnZzzYde9hcexPoDegv4HBuiUwk2wLKSXazu9hE/edit?usp=sharing
Sheet 2 has the function that I used and the result.
It is not entirely clear what you want to do, but try this. In Sheet1 in E2 put this combining Col A and D:
=arrayFormula(A2:A & if(isBlank(D2:D),""," ") & D2:D)
In F2 combine Col C and D with this:
=arrayFormula(B2:B & if(isBlank(C2:C),"",",") & C2:C)
In G2 find the unique values from Col F with this:
=UNIQUE(E2:E)
In H2 put this and drag the formula down:
=join(",",query(E2:F,"select F where E contains '"& G2 &"'"))
Hide Cols E & F