I want to Use ArrayFormula for JoinText for multiple columns which have their own ArrayFormulas in Google Sheets.
My formula works for columns that have plain text values but for some reason Google Sheets gives me an error when I apply it to columns that have their own ArrayFormulas applied to them.
Take a look at the example sheet I've created HERE
Any help will be appreciated!
I hope this solution with query is helpful for you:
=ArrayFormula(transpose(query(transpose(C1:D),,2)))
(Will work faster if you know the limit of the range, e.g. C1:D10).
For implementing commas between the columns you can use
=ARRAYFORMULA(IF(C1:C="",D1:D,if(D1:D="",C1:C,C1:C&", "&INDIRECT("D1:D"))))
I put this formula in cell I2 on your sample sheet. It should be relatively fast for many thousands of rows.
=ARRAYFORMULA(SUBSTITUTE(TRIM(C2:C&CHAR(10)&D2:D),CHAR(10),", "))
Related
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")
I am trying to use a formula in google sheets to find averages based on the contents of a different cell.
Below is some sample data, I am pretty sure I have done similar in the past in Excel by using table headers as a reference but struggling to see how to achieve this in google sheets.
Columns B, C, D to be calculated, currently this is the formula used for D3 (same sort of thing for D4) =IFERROR(ROUND(SUM(E3:H3)/COUNT(E3:H3),2),0)
Just needing to work out the formula for the cells with red text, any help would be appreciated.
as an example C3 would be the average for any numbers in row 3 where it has DeviceB e.g. (2+10+6)/3
Try
=AVERAGEIF($E$2:$H$2,B$1,$E3:$H3)
AVERAGEIF
I'm trying to use arrayformula to expand the formula below but it's not working. When I copy-paste manually the formula into each cell it works.
=arrayformula(INDEX($1:$100,ROW(B2:B),match(YEAR(M$1:$1),$1:$1,0)))
What I want to achieve is to convert yearly salaries into monthly salaries based on years.
The spreadsheet can be viewed here:
https://docs.google.com/spreadsheets/d/1veiYh1CMIfFPwBGQk4OwKmCLa7q08TugReVfAXtpIgI/edit#gid=1363287956
Thanks!
Solution:
Since you are looking for a specific column, you can use HLOOKUP as a substitute for INDEX and MATCH:
=ARRAYFORMULA(HLOOKUP(YEAR(M1:AT1),A1:H11,ROW(B2:B11))/12)
This should yield the same result as the previous formula:
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.
I need Google Sheets to compute sums for each row using the arrayformula() function.
I know I can manualy enter somthing like;
=ARRAYFORMULA(A:A + B:B + C:C)
but I need the use of the functions to do it.
I've tried many things including;
=ARRAYFORMULA(sum(A:A,C:C))
Here is a sample file that I could use help with.
This formula works in cell G3 of your test sheet:
=ArrayFormula(mmult(ARRAYFORMULA(IF(ISBLANK(A3:C),0,A3:C)),sign(transpose(column(A3:C)))))
I've used a custom format to hide the zero values on the empty rows as well
Formulas
Addition (SUM)
QUERY function
=QUERY(A3:C20,"Select A+B+C Label A+B+C ''")
Concatenation
& operator
=ArrayFormula(J3:J20&K3:K20&L3:L20)
CONCAT function
=ArrayFormula(CONCAT(CONCAT(J3:J20,K3:K20),L3:L20))
Explanation
Besides ARRAYFORMULA, Google Sheets has QUERY, FILTER, ARRAY_CONSTRAIN, among other functions that could help you to handle array operations. Take a look to Function List to have the complete list. Also could be very helpful that you to take a look to Using arrays in Google Sheets.