Google Sheets ADDRESS formula for a RANGE - google-sheets

In Google Sheets, I currently have several sheets that represent classes and for example sake, might look like this:
CLASS1:
A1-Tom
A2-Fred
A3-Betty
CLASS2:
A1-Bruce
A2-Jane
A3-Sandy
Then in another sheet, SUMMARY, my goal is to create an overview showing in a "CSV" format by class the names of the students, something like this:
COLUMN_A:
A1: CLASS1
A2: CLASS2
COLUMN_B:
B1: Tom, Fred, Betty
B2: Bruce, Jane, Sandy
I can achieve what I need in column B with static cell references with the following formula:
=TEXTJOIN(", ",TRUE,CLASS1!A1:A3).
However, with that I need to manually change the sheetnames in the formulae (e.g. CLASS1!A1:A3 to CLASS2!A1:A3 and so on), when I'd just like to be able to copy it down, using the values in column A to stand in for the sheetnames.
I'm at the point where I've managed to use the values in column A to return a result based on the location of the first item in the respective sheets as follows:
=TEXTJOIN(", ",TRUE,INDIRECT(ADDRESS(7,1,4,TRUE,$A1)))
However, this obviously only returns the first item in my list. For it to work in the same manner as my static solution above, I need to make it work for a range. And that's where I'm stuck.
Any help would be very much appreciated.

try dragging:
=TEXTJOIN(", ", 1, INDIRECT("CLASS"&ROW(A1)&"!A1:A3"))

Related

Select the last two names in google sheet

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",""))

How can I make an statement to output different things based on other cells

I'm writing a spreadsheet for a planning of some sort. It is about a band with multiple musicians on sometimes the same instruments. I've made two sheets. One for the musicians to let them show when they'll be present, while the other has to make an overview of all musicians present on certain dates.
I've already made an if statement to show when one of them is present, which would look like this in simple code:
if(B2)
print("Eric")
What I actually would want is an if statement to show when they are both present. In simple code it would look like this:
if(B2)
print("Eric")
if(B2 && C2)
print(", ")
if(C2)
print("Frank")
Really simplified.
I've made an example spreadsheet to show what I've already got. Here it is:
https://docs.google.com/spreadsheets/d/17gyoh5NUdiUWB_Nq0w3FAc1OsWQygzRYd_kzm0ijdJA/edit?usp=sharing
So what I would like to see with input as: B3=TRUE, C3=TRUE.
in sheet2 it should then show in B3: Eric, Frank
How about this answer? I think that there are several answers for your situation. So please think of this as one of them.
Sample formulas:
Please put 1st and 2nd formula to "B3" and "C3" of Sheet2, respectively.
=TEXTJOIN(", "; TRUE; ARRAYFORMULA(IF(Sheet1!B3:C3=TRUE; Sheet1!$B$2:$C$2;)))
and
=TEXTJOIN(", "; TRUE; ARRAYFORMULA(IF(Sheet1!D3:G3=TRUE; Sheet1!$D$2:$G$2;)))
Retrieve values that the checkbox is checked using IF and ARRAYFORMULA().
Join the retrieved values using TEXTJOIN().
Result:
For example, when B3, C3, E3 and F3 of Sheet1 are checked, Sheet2 becomes as follows.
References:
ARRAYFORMULA
TEXTJOIN
If I misunderstand your question, I'm sorry.

Array Several Columns to One with Column Headers as Separate Column

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

Fetch Row of Value From Other Spreadsheet Google Sheets

I would like to access data from one Google Spreadsheet on another using strictly formulas.
Currently, I am able to import data using the =IMPORTRANGE(), but need to take this a couple steps further.
The data that I have looks like this:
Spreadsheet 1: Each sheet is for a different day, and has people and the number of fruits they pick from a farm (this is example data). However, the people are not necessarily organized exactly the same way on each day.
Spreadsheet 2: Each sheet is organized by person. Row A has the day (which will be used to lookup from the other spreadsheet), and a function exists in the second spreadsheet to find the persons name (=sheetName()).
What I have so far is [for Spreadsheet 2]:
=IMPORTRANGE(Master!A1, A2 & "!B2")
Where Master!A1 refers to the link of the other spreadsheet, A2 refers to the Day1. However, the part I am looking to replace is the 2 in the B2 to find the row of the person's name in the sheet Day1 from the first spreadsheet.
I feel like I have to do something like this:
=IMPORTRANGE(Master!A1, A2 & "!B" & MATCH(IMPORTRANGE(Master!A1,A2 & "!B1:B100"),sheetName(),0))
, but this gives me the error that it "Did not find value 'Apples' in match evaluation"
Here is the example folder with the two spreadsheets.
https://drive.google.com/drive/folders/0B8lJN2vmKeTBV1JYR2ZoZlVfQUU
All help is appreciated!
I can't find the sample data that you attached but here's what you need to do.
1. Link of the other spreadsheet
2. Name of the sheet to import from
3. =importrange(link,sheet!A:D) [for the sake of an example]
4. =query(importrange(link, sheet!A:D),"select * where Col1 = 'Person's_Name' ",1)
Share a sheet if you are not able to put it together on your data. Cheers!!

Use text from cell with IMPORTRANGE

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.

Resources