[google spreadsheets]Joining Multiply Arrays in one formula - google-sheets

I am long looking for solution to a problem that states as this:
I have 3 different ranges in my spreadsheet (lets say they are on different sheets) and I want to join them all on the 4th sheet as one array (like one under another).
And here is my question how can I dot it? I want to then use filter on the given range to make all 3 ranges one sorted range and I want it to enlarge dynamically when I add new rows to one of the source ranges.
I basically tried to use Arrayformulas and query formulas but I didnt found any solution.
Does anybody have any clue or idea how to solve this problem?
Thanks in Advance
volmort

You can use "Embedded Arrays" to achieve this result.
Source Data in:
D6:F9
H6:J9
L6:N9
Formula to aggregate all data ranges:
=FILTER(
{ARRAYFORMULA(D6:F9);ARRAYFORMULA(H6:J9);ARRAYFORMULA(L6:N9)}
, {ARRAYFORMULA(D6:D9);ARRAYFORMULA(H6:H9);ARRAYFORMULA(L6:L9)} <> ""
)
Note: un-populated rows in the source data ranges are "filtered" from the results. An un-populated row is a row with no data in the first column of the range.
If this result is not desired, then a simpler version with ARRAYFORUMULA could be used:
=ARRAYFORMULA(
{ARRAYFORMULA(D6:F9);ARRAYFORMULA(H6:J9);ARRAYFORMULA(L6:N9)}
)
Here is an demonstration of the solution:
https://docs.google.com/spreadsheets/d/1HTyIpaLU0dm89ZY8ka9SI0J2nywnS9QteFY1h9BxdR0/edit?usp=sharing

Related

Potentially complicated formula with FILTER, VLOOKUP and multiple sheets

I am looking at using a filter to pull data from one Google sheet automatically to another Google Sheet.
The problem is, some of the values in the cells contain "," which mismatch my vlookups.
I have figured out the formula I need to automatically filter this, but I can't wrap my head around how to insert it with a filter formula.
EDIT: The below formulas are on a separate sheet to Data1 & Data2 called "Filter Sheet"
Here are the two formulas I'd like to combine:
=filter('Data2'!C2:C,'Data2'!A2:A="uk")
This one cleans up the values with "," in them:
if(REGEXMATCH(A8,","),iferror(VLOOKUP(index(split(A8,",",1),1,1),'Data1'!A2:A,1,0),iferror(VLOOKUP(index(split(A8,",",1),1,2),'Data1'!A2:A,1,0),false)))
**EDIT:The formula above looks to a different sheet (Data1) to see if the "split" result matches the VLOOKUP on the current sheet. If it does not then it goes through a loop to finally find a match on Data1 Sheet.
Essentially, I want the second statement to**
How do I insert this "clean up formula" so it can work with the filter formula values?
EDIT: How can I combine the filter formula with the "if(regex etc. formula" based on the conditions set?
OR is there an easier way of doing this?
If this helps with an easier method:
The reason why I use a filter formula is because not everything in Data Sheet 1 is found in Data Sheet 2, so this smooths that process out.
Your help is greatly appreciated and thank you in advanced.
Try this formula directly
=filter(Data2!C2:C,REGEXEXTRACT(Data2!A2:A, " (uk)")="uk")

Google sheets: How to write a formula that performs a sum from column_x until previous column and apply it to the rest of the columns

I have these two columns:
For the next columns I would to apply this formula:
SUM[all_previous_columns]
I would like to write it once for the third column and apply it for the rest of the columns.
Any idea how to do this?
You mean this?
You should use absolute addressing to first column in the range you want to sum and relative addressing to last column. Then you can drag your formula right as far as you want.
As it just doubles each time, you could also write it as an array formula:
=ArrayFormula((A1+B1)*2^(column(C1:1)-3))

How to use AVERAGEIF in Google Sheets, only addressing columns with a specific text

In Google Sheets, I'm trying to use AVERAGEIF to calculate an average of only some of the columns in another table.
The columns to be included in the average are marked by some text in a specific cell (e.g. the first or last row of that column).
Some columns are to be included in several averages, so the text in the top\bottom row would include several words (effectively meaning I'll need some sort of substring check such as FIND).
I've tried using AVERAGEIF() in conjuction with FIND() but couldn't get this to work.
Any ideas?
Here is an example of how the data sheet looks like, and how I would expect it to work
You can use following formula:
=ARRAYFORMULA(AVERAGE(IF(ISNUMBER(SEARCH(D2,A2:A9)),B2:B9,"")))
Edit:
For table mentioned in comment you must change ranges:
=ARRAYFORMULA(AVERAGE(IF(ISNUMBER(SEARCH(E2,$A$1:$C$1)),$A$2:$C$4,"")))
You can use a query
=AVERAGE(QUERY(TRANSPOSE($A$1:$D),"where Col1 contains '"&D1&"'"))
Functions used:
AVERAGE
QUERY
TRANSPOSE

Excel/Sheets Consecutive Count Based on Two Conditions (function?)

I have a Google Sheet, and I'm trying to see if it's possible to get a consecutive count outputted in a third column based on the values of two other columns.
My columns are:
Column A: Will have a handful of text values that are "grouped" together. Likely around 30 of the same value, until it changes to another value. In the image above, these are text1, and text2.
Column B: Will have one of 3 values assigned to each value in column A. In the image above, these are id1, id2, id3.
Column C: Will output a consecutive count based on the values of the first two columns. My hope is that if there are multiple ID1,ID2 in consecutive order, they'll repeat that first +1 value; while ID3 is always plus 1 to the count. This is what I am trying to show in column C in the layout image above.
I've hit a wall with trying to accomplish this with various COUNTIF iterations.
Thanks for any help, or any better ideas to accomplish something similar.
(I'm hoping for a formula, but open to being pointed into a direction for a script if that's the only way).
You can try following formula:
=IF(A2=A1;IF(OR(B2="id3";B2<>B1);C1+1;C1);1)
It is also possible to do this as an array formula. I used offset ranges for column B in the first Countifs to check for a change in value but this made it a little awkward to get equal-sized arrays:
=ArrayFormula(if(A2:A="","",
countifs({"";B2:B}<>{B2:B;""},true,{A2:A;""},A2:A,row(A:A),"<"&row(A2:A),{B2:B;""},"<>id3")+
countifs(A2:A,A2:A,row(A2:A),"<="&row(A2:A),B2:B,"=id3")
))

Google Sheets, Is it possible to use Arrayformula to expand formulas downward when the formula uses arrays

I've been using Arrayformula to auto-expand formulas (such as "=Left(A2:A,B2:B-1") downward, but I need some help understanding this formula. I've read up on the function itself and browsed many forums about this but I can only find articles explaining how to use this with simple formulas, so I'm going to try to as this as simply as possible here: Is it possible to use Arrayformula to expand formulas downward when the formula uses arrays?
The summary for Arrayformula reads "Enables the display of values returned from an array formula into multiple rows and/or columns and the use of non-array functions with arrays." This was my understanding of how Arrayformula populated a formula into rows automatically. Using this I thought of it as writing a formula that generated an array of formulas, and then splitting them up with Arrayformula. This seems to not work with some formulas such as concatenate, which I will focus my question on. This example is far from my real life problem, but if someone could show me a solution I can apply it elsewhere.
Arrayformula spreadsheet example
Usually when I use Arrayformula with A1:A it would expand the formula through the column, referencing the corresponding rows as it went. With this example I want to have Column C be the concatenated result of columns A and B. Is this possible with Arrayformula? This question is not specific to concatenate, that is just the simplest one that came to mind. Another example would be Countif. Lets say I want to see how many values in the first 5 columns are over 20, and I want that formula to auto populate down, is that possible and if so how would it be done?
Arrayformula second example
P.S. Please don't say copy the formula using the drag handle in the lower right.

Resources