In my data sheet1, I want to use the 'Name in use' column (B) with the last two names with ARRAYFORMULA.
In my data sheet2, I want column (B) to be repeated with the same code next to the column A get filled
Please find the sample date sheet below https://docs.google.com/spreadsheets/d/1_AWRjexJNAcgNGsmrBKU_8JYL03UbAGeiyy4oI8B9fU/edit?usp=sharing
Regards,
Nimal PereraSri Lanka
Sheet 1
Your formula seems fine, just the ArrayFormula() needs tweaking. As noted in the docs, ArrayFormula() takes in a range, rather than a single cell.
You would have to do something like this:
=ARRAYFORMULA(IFERROR(UPPER(TRIM(RIGHT(SUBSTITUTE(A2:A5," ",REPT(" ",60)),120)))))
Essentially you type in the range you'd like it to apply on. So at any moment, instead of selecting a single cell for that row, you select the range. If you'd want to apply it to the entire column, use A2:A. You even did it right on sheet2
Sheet 2
Your names seem to be importing correctly once Sheet1 is done right. To have the same code everywhere, use something like this:
=ARRAYFORMULA(IF(LEN(A2:A),"SSD",""))
Related
In a Google spreadsheet, I want to sync A2:G500 in sheet1 to sheet2, I've been aware of the following two methods:
use IMPORTRANGE: put the following formula in A1 of sheet2:
=IMPORTRANGE("spreadsheet_url",sheet1!A2:G500)
It works but it feels like I am overdoing it, besides there seem to be a performance issue
In A2 of sheet2, put formula =sheet1!A2, then drag the formula to G500 in sheet2. This one is intuitive and simple to do. However, it doesn't work if sheet1 is a form response sheet - when new response is added, sheet2 won't automatically get it.
For learning purpose, I'm wondering if there is a way to do this using Arrayformula. Besides, I want to find a way to make this sync more care-free, meaning if there are indefinite rows of data I won't have to go back to this sheet every now and then and change the formula or manually drag the formula. Is this possible? And is Arrayformula the right way to go for this purpose?
I would recommend an { array expression }, like this:
={ Sheet1!A2:G }
This is more or less the same as
=arrayformula(Sheet1!A2:G)
...but I prefer the {} syntax because it allows you to specify non-adjacent columns. For example, you can skip columns D and F like this:
={ Sheet1!A2:C, Sheet1!E2:E, Sheet1!G2:G }
In spreadsheets where the locale uses the comma as decimal mark instead of the period, use a backslash \ instead of comma as horizontal separator.
To skip rows, use the semicolon ; as vertical separator. For example, you can skip rows 2:9 like this:
={ Sheet1!A1:G1; Sheet1!A10:G }
The open-ended range reference A10:G means "columns A to G starting in row 2 and extending all the way to the bottom of the sheet."
You can also leave out the row number to get an open-ended range reference like A:G which means "columns A to G from the very top to the bottom of the sheet." This reference will behave the same as A1:G in almost all situations. I have made it a habit to always include the start row in the reference because that way the formula will automatically adjust in the event a row is inserted above row 1.
When the source sheet is a form responses sheet, another tactic is needed. Form responses are always inserted in newly created rows that cannot be referenced directly in advance.
To avoid the range reference from adjusting when you dynamically copy form responses to another sheet, start the copy from row 1, like this:
={ 'Form Responses 1'!A1:A }
Alternatively, use an array formula, like this:
=arrayformula(
if(
row('Form Responses 1'!A1:A) = 1,
"Enter column header here",
'Form Responses 1'!A1:A
)
)
An even better way to deal with form responses is to aggregate the data directly to whatever reports you need with the query() function.
It's either:
ArrayFormula(Sheet1!A2:G500) for the 499 lines, or
ArrayFormula(Sheet!A2:G) if you wanto sync everything from line 2 down
=ARRAYFORMULA(Sheet1!A:G)
Does this not work?
try in row 1:
={""; INDEX(sheet1!A2:A)}
this will solve your form issues when you use it in 1st row. if you already have something in your row 1 you can add it into double quotes like this:
={"header"; INDEX(sheet1!A2:A)}
in case of multiple columns its like this:
={"","","","","","",""; INDEX(sheet1!A2:G)}
I have a sheet where the query formula used is very simple.
Here is the test sheet
It just have to display the conetents of the second sheet in the first. Unfortunately, at some point the cell values are merged into single cells.
The example below shows till Apple1 to Apple 10 the data is merged in row 1.
I need a reason for this error and please avoid answering like, delete the row 15 of fruits tab sheet to correct.
Any cause for this is really appreciated.
Sheet2
Sheet1
QUERY has several arguments. If you don't include them, they are assumed to be defaults (with the third argument being to try to make the first row into a header). Try this instead:
=query(Fruits!A3:F,"Select *",0)
or you can leave the middle argument blank in your case:
=query(Fruits!A3:F,,0)
I'm trying to return the column headers for a row that is marked with an x. The row is selected from a name in the left column. I'm stuck here.
I can illustrate what I want to do by showing these images:
Start table
The result I want is this:
Outputs of the possibilities for the first sheet
I have put more information in my Example Sheet.
Link to editable example sheet
This formula should create a table (with a single formula) with the months in one column and the headers in the second column.
=ArrayFormula({A4:A15\ substitute(transpose(query(transpose(if(B4:G15="x";B3:G3&char(10);));;rows(A4:A15)));" ";)})
If you'd want to 'lookup' the months you manually type in you can wrap the above in a vlookup. Example:
=ArrayFormula(if(len(L4:L); vlookup(L4:L; {A4:A15\ substitute(transpose(query(transpose(if(B4:G15="x";B3:G3&char(10);));;rows(A4:A15)));" ";)}; 2; 0);))
You can check out both formulas in the copy of the sheet I've made in the spreadsheet you shared.
I am looking to take several columns in Google Sheets and combine them into one with the column header in an adjacent cell.
I would like to go from something like this:
to something like this:
I am currently achieving this by arraying the first column over and over for the number of columns. I am then arraying each column on on top of another so something like this:
Column 1 Column 2
={A1:A4;A1:A4;A1:A4} ={B1:B4;C1:C4;D1:D4}
In a third column I am using an if-then statements to get the Column name wherever the name column = "Name"
My issue is when I am trying to do this with several columns is becomes very tedious to build out these arrays. I am looking for help with a single formula to achieve this by just referencing the range for all columns.
It's a little tricky, but possible. For explanatory reason I am not putting everything into one, convoluted formula, but present step by step solution. DISCLAIMER: It's fast one, so it in not perfect.
Assumptions:
"Start" data are in Sheet named "Data"
Result is in Sheet named "Result"
Procedure
Add one column (A) to "start" data with this code in A1 (it will be our index):
=ArrayFormula(if(B1:B<>"";row(A1:A)-1;""))
In "Result" sheet put in A1 this code:
=ArrayFormula(INT((ROW(B1:INDIRECT("C"&(COUNTA(Data!$B1:B)-1)*4))-1)/4)+1)
In B1 this code:
=ArrayFormula(if(A1:A<>"";VLOOKUP(A1:A;Data!A1:E;2;0);"" ))
In C1 this:
=transpose(SPLIT(REPT(TEXTJOIN("*";1;Data!C1:1)&"*";COUNTUNIQUE(B1:B));"*";0;0))
In D1 this:
=ArrayFormula(IFERROR( VLOOKUP(B1:B;Data!B1:F;MATCH(C1:C;Data!B1:F1;0));""))
Finally in F1 - to clean the result put this:
={{"Name"\"Column"\"Number"};{B1:D20}}
Link to working copy
Link to spreadsheet
Final thoughts
You can pack everything into one formula
Its very hasty solution, so it will not expand to more than 4 columns by itself (One, Two, etc). This is hard-coded now. If you can't figure it out, just give me a comment - I will show this places / fix them to make it dynamic
I have two Google Sheets: the first contains data per week and the second gives an overview of that data. The sheets in the first are named by week. For example: Week 1, Week 2, Week 3, Week 4 ... The sheets in the second contain one cell which has the same text as the sheet names of the first document. This cell is A1.
Using the IMPORTRANGE function I want to show some data from the first (data) document in the second (overview) document. Currently the IMPORTRANGE formula looks like this:
=IMPORTRANGE("https://docs.google.com/...; "Week 1!C2:C5")
As you can see I have to change the sheet name I reference to manually. I want it to change automatically using the text in cell A1. So it should look like this:
=IMPORTRANGE("https://docs.google.com/...; "A1!C2:C5")
Is it possible to do it like this or do I need a script and how can I make it work?
Thank you for your tip about using ranges, I will use it in the future. You suggested the following formula:
=IMPORTRANGE("https://docs.google.com/...; A1)
It didn't work. I got it to work with the following formula:
=IMPORTRANGE("https://docs.google.com/..."; (A1&"!C2:C5"))
sure, just try it:
=IMPORTRANGE("https://docs.google.com/..., A1)
I also recommemnd you use named ranges (google it). this allows you to just type in "week1" into cell A1, instead of something like "Sheet3!A1:B343." Without named ranges any complex spreadsheet will turn your formulas into an indecipherable mess.