Arrayformula not copying down when using AverageIF - google-sheets

Having trouble making ARRAYFORMULA copy down its values when using it in combination with AVERAGEIF. Here is my google sheet. It works fine when I copy down the formula, it just won't auto-populate.
Here is my current formula
=ARRAYFORMULA(AVERAGEIF(A2:A,A2,B2:B))

use:
=ARRAYFORMULA(IFNA(VLOOKUP(A2:A, QUERY(A2:B,
"select A,avg(B)
where A is not null
group by A
label avg(B)''"), 2, 0)))

Related

Is there a way to use arrayformula in google sheet to join text with conditions?

Is there a way to get the result column in the picture below?
All i want to do is text join the Col1 if the corresponding Col2 belongs to the same groups (E.G. 1,2,3....).
Reminded that I want to use arrayformula instead of dragging down the "normal" formula myself everytime.
Use this formula
Or Make a copy of this example sheet.
=ArrayFormula({"Result";
IF(A2:A="",,
BYROW(B2:B,
LAMBDA(v,JOIN(", ",FILTER(A2:A,B2:B=v)))))})
Great news for google-sheet lovers that google releases new lambda formulas. You can use BYROW() function to make it spill array. Try below formula.
=BYROW(C3:C9,LAMBDA(x,JOIN(",",FILTER(B3:B9,C3:C9=x))))
To refer entire column use FILTER() function for BYROW().
=BYROW(FILTER(C3:C,C3:C<>""),LAMBDA(x,JOIN(",",FILTER(B3:B,C3:C=x))))
Suppose my range of data from B3:C9, want to group the result according the the Column C (or Col2)
Here is the formula i googled without using the Lambda function
=ARRAYFORMULA(REGEXREPLACE(TRIM(SPLIT(FLATTEN( QUERY(QUERY({ROW(C3:C9), C3:C9&"×", B3:B9&","}, "select max(Col3) where not Col2 starts with '×' group by Col1 pivot Col2"),,7^7)), "×")), ",$", ))
Notice the 7^7 is the (length of the data)^(length of the data).
i.e. from 3 to 9, there are 7 data.

How to sum results obtained with VLOOKUP and IMPORTRANGE in Google Sheets?

I'm currently obtaining the result with the formula below, which was nicely provided by player0, but the challenge now is to obtain not only the figure found, but a sum, since the occurrences in the "database" may be multiple.
=Arrayformula(if(A9:A="";;IFNA(vlookup(A9:A&D9:D&"Expedição"&"Costura";
{IMPORTRANGE("fileId";"Produção!F2:F")&
IMPORTRANGE("fileId-1n3nQ";"Produção!H2:H")&
IMPORTRANGE("fileId-1n3nQ";"Produção!R2:R")&
IMPORTRANGE("fileId-1n3nQ";"Produção!B2:B")\
IMPORTRANGE("fileId-1n3nQ";"Produção!N2:N")};2;0))))
I have tried including sum in many places in the formula above, but with no success.
Here's a file with dummy data.
Thanks in advance.
use:
=ARRAYFORMULA(IF(A4:A="",,IFNA(VLOOKUP(A4:A&" "&C4:C&" Expedição Costura ",
QUERY(SPLIT(FLATTEN(QUERY(TRANSPOSE(QUERY({IMPORTRANGE(
"1gh5w0czg2JuoA3i5wPu8_eOpC4Q4TXIRhmUrg53nKMU", "Data Origin!A2:R")},
"select Col6,Col8,Col18,Col2,'×',Col14 where Col14>0 label '×'''", )),,9^9)), "×"),
"select Col1,sum(Col2) where Col2>0 group by Col1"), 2, 0))))

How to use ranges in formulas with external sheet links

I'd like to use a SUMIF formula in one sheet that references a range in a separate sheet.
My problem is that using the range in this situation is only working for the first column of the range. So if my formula is:
=SUMIF('Data Referenced'!$A$2:$A,Formula!$A2,'Data Referenced'!$B$2:$M$11)
then it only adds as if I used the range B2:B. Using the same formula with internal ranges works fine as expected, so I'm not sure what I'm doing wrong.
I've laid out my example in the Google Doc linked below:
https://docs.google.com/spreadsheets/d/13zT2GlElgW5JkU90sOBeVlhr7FDOYeqaysDE-39fyao/edit?usp=sharing
use in B2:
=ARRAYFORMULA(IFNA(VLOOKUP(A2:A, QUERY({'Data Referenced'!A2:A11,
MMULT('Data Referenced'!B2:M11*1,
SEQUENCE(COLUMNS('Data Referenced'!B2:M11))^0)},
"select Col1,sum(Col2) group by Col1"), 2, 0)))

Google Sheets: Use ArrayFormula to copy a formula until a set value

I'm trying to create a formula until a set value using ArrayFormula in Google Sheets.
The end result values can be viewed on the spreadsheet:
https://docs.google.com/spreadsheets/d/1yBC4oQuhKOkIkf3lQZGBKcZQ3YjU_5N6MCIJZzdt0O4/edit?usp=sharing
Thank you!
delete everything from red cells and use this in D4:
=ARRAYFORMULA(IFERROR(SUBSTITUTE(SPLIT(REPT("♠♥", B4:B-1)&
REPT(B1/C4:C&"♥", C4:C), "♥"), "♠", )))

Add Filter to Vlookup formula Google sheets

I know verry little about formulas
I have a Vlookup formula which is working
=ArrayFormula(iferror(vlookup(ConnectionHelper!M2:M, ConnectionHelper!$D$2:$E, {2,1}, false)))
I want to FILTER out rows if a cell in column D is empty
But not getting how or ever if possible!
I am trying
=Filter(ArrayFormula(iferror(vlookup(ConnectionHelper!M2:M, ConnectionHelper!$D$2:$E, {2,1}, false))),D2:D<>'')
Thanks
Try
=query(ArrayFormula(iferror(vlookup(ConnectionHelper!M2:M, ConnectionHelper!$D$2:$E, {2,1}, false))), "where Col2 <>''")
(assuming your data in column D is text).

Resources