On cell referencing in google sheets, clarification needed - google-sheets

On sheet Summary, I have a cell A1 that has a value "AAPL"
On sheet AAPL, I have a cell X22 that has a value "123"
In order for me to display "123", I do =AAPL!X22. Pretty straightforward.
How can I rewrite this using A1 value? In other words instead of hardcoding AAPL, I would like to express .. whatever is in A1 cell
I tried
=&A1!X22 but this didn't work.
Thank you for your time

Use INDIRECT. Enclose the !X22 in quotes and do not put quotes around the reference to the cell containing AAPL (in your question A1, or in the comments D30):
=INDIRECT(D30&"!X22")

Related

GSHEET How do I Extract Text from formula for creating automatic cell reference

The context :
Each time i need a cell reference from my other sheet, I need others cell reference from the same line but from different column.
I would like to automate those adding reference values depending on the first reference i add manually.
I have a sheet named alpha and a sheet named beta
I have a cell A1 in alpha that refers to beta A1
I have this referred cell formula in alpha A1 to have the value from beta A1
=beta!A1
Objectif :
I would like to have in alpha B2 the cell automatically filled-in by the value from beta A7
the equivalence of this refered cell formula
=beta!A7
Because the number seven will never change, only the column can change it could be:
=beta!AC1
so I will need =beta!AC7 automatically populated.
The Goal :
The goal is to extract from the formula in alpha A1 all characters except number(s) by a formula (like SEARCH, LEN, from FORMULATEXT) to obtain
=beta!A
with this result, I will concatenate with a cell that has the value "7". to obtain the formula for the cell reference.
A
B
C
1
=beta!A1
=beta!A7
7
2
=beta!AC1
=beta!AC7
If anyone can give me this formula clue or a better way to reach my goal would be good
I tried the regex below but it removed the punctuation
=REGEXREPLACE(FORMULATEXT(A1),"[^[:alpha:]]", "")&C1 where C1 is the value "7"
But i have all the need without the exclamation mark "!"
=betaA7
instead of
=beta!A7
Thank you
this is what you want
Use this to REGEXEXTRACT all the numbers and REGEXREPLACE then with "" nothing. and add &$C1 the value in C1.
=REGEXREPLACE(A1, REGEXEXTRACT(A1, "[0-9]+"), "")&$C1
A better way
See in Beta!A1 we have a value of Im beta A1
And in Beta!A7 we have a value of Im beta A7
And in alpha!A1 we hane the formula =beta!A1
To get the value of beta!A7 using the formula in alpha!A1 as an input we use this formula in beta!B1
=INDIRECT(REGEXREPLACE(SUBSTITUTE(FORMULATEXT(A1),"=",""), REGEXEXTRACT(SUBSTITUTE(FORMULATEXT(A1),"=",""), "[0-9]+"), "")&$C1)
Explanation
INDIRECT(=beta!A1)
Even more simpler approach
Use this formula directly
=OFFSET(beta!A1,C1-1,0)

How can I get this formula to grab values between the commas?

Here is a screenshot of and a link to my test spreadsheet. It makes the requirements very clear:
https://docs.google.com/spreadsheets/d/1rZr2zHaSkff9SFpwpx83_4TawruotA1jhOKqW6uYDz0/edit?usp=sharing
The formula I have come up with is very close to what I need, but "linkText" is a placeholder for the value of the array item. Here is my formula:
=if(A2="","","<a href='https://samplewebsite.com/search?q=" & trim(lower(substitute(A2,",","'>linkText</a>, <a href='https://samplewebsite.com/search?q="))) & "'>linkText</a>")
try:
=index(join(","&char(10), SUBSTITUTE($B$1, "linkText", split(A3, ","))))
Drag down to column.
Result:
First using SPLIT to split the strings between comma from the column A. Then using SUBSTITUTE to find the string "linkText" from the text in B1 and replace it with the strings from the returned strings from the split function. Then joining them all together.
NOTE: Just keep the reference string in a fixed cell in your sheet. <a href='https://samplewebsite.com/search?q=linkText'>linkText</a> to be used in the formula. As seen in above screenshot it is fixed in cell B1.
Alternate Solution using ArrayFormula:
You can also use it with arrayformula so you only have to put it in the first row and no need to drag down the formula to the column, it will automatically be expanded down just make sure to clear the cells below or it will throw an error.
=arrayformula(regexreplace(substitute(transpose(query(transpose(IF(IFERROR(SPLIT(A2:A, ","))<>"", "♦<a href='https://samplewebsite.com/search?q="&SPLIT(A2:A, ",")&"'>"&SPLIT(A2:A, ",")&"</a>", )),,9^9)), "♦", char(10)), "^\s", ""))
Result:
You may also have a look in below references for more information.
References:
SUBSTITUTE
SPLIT
JOIN
Comma separated list into matched columns pairings

How can I use conditional formatting to compare against a dynamic worksheet?

I am trying to use conditional formatting to compare the value of one cell against another in a dynamically referenced worksheet while using a dynamic cell reference and highlight the cell whenever the values do not match.
I have created a master sheet containing a cell with the name of the worksheet I wish to reference. This cell will be updated periodically with the name of the relevant worksheet. I am able to write a formula that correctly returns the value I wish to compare, but when I enter this expression in the conditional format rule (format cells if is not equal to) I am given a red outline with the message "Invalid formula".
I have tried various combinations such as using a custom formula and using (current cell = (formula here)) and while I am not given an error, it still does not work as intended.
I am comparing the value of cell C2 in worksheet 4719 to cell C2 in worksheet 4717. A cell in a worksheet called Mastersheet contains the entry "4717" in B1, and this is the cell that will be periodically changed to something like 4717 for example.
The formula that is able to successfully return the value I am after is =indirect(Mastersheet!B1&"!"&"C2") but I was only able to accomplish this by putting the "C2" reference in quotation marks, which is not dynamic and thus would have to be manually changed to work for any of the other values in column C.
I expect cell C1 in worksheet 4719 to turn green as the value there is different from cell C1 in worksheet 4718.
I made a publicly viewable copy of my Google sheet if my explanation does not make enough sense https://docs.google.com/spreadsheets/d/1s0oaGas46akmGV7hapnDOdhndcWudyq239kmCrLnt3U/edit?usp=sharing
try it like this:
=INDIRECT(Mastersheet!$B$1&"!"&ADDRESS(ROW(C2), COLUMN(C2), 4))
this can be used in Conditional formatting, however, referenced sheet cant be fully active so:
=INDIRECT(INDIRECT("Mastersheet!B1")&"!"&ADDRESS(ROW(C2),COLUMN(C2),4))
this can be further moded so the B1 would be dynamic too:
=INDIRECT(INDIRECT("Mastersheet!"&ADDRESS(ROW(B1),COLUMN(B1)))&"!"&
ADDRESS(ROW(C2),COLUMN(C2),4))=19

SPREADSHEET INDIRECT() with variable column

If A1 has a value of 2, =INDIRECT("L"&(5+A1)) will return me cell L7's content. And my A1 value keeps on being updated.
But I need a way to sort through columns instead of rows, like
L7, M7, N7, O7 and so on...
Which formula can help me sort through the columns? I also know that =COLUMN() returns the current column converted to number, but I had no luck with =INDIRECT((column()+A1)&7).
You can use the address() function inside indirect. Address() returns a cell reference as a string. So for example, if you enter in G5
=indirect(address(A1, column()))
while A1 is 1 the above formula will return the contents of cell G1.
See if this helps?

how to concatenate a section of a column of data

Is it possible to use a cell to define the end of a range for a formula?
Essentially, I would like to use the JOIN() statement to concatenate a section of a column of data.
The data starts at a cell, say A5, and runs to a cell with the word 'total' in it. I've created a cell (let's call it L12) which returns the number of rows of data that are available.
I'd like to use that cell to form part of the range details of the JOIN() formula thus:
=JOIN(" ", A5: A[the value in L12]).
Is this possible?
I've found the indirect() function does exactly what I needed it to do.
See the Google function list https://support.google.com/docs/bin/static.py?hl=en&topic=25273&page=table.cs

Resources