I have the following in my Google Sheet to pull number of views from a YouTube page:
=IMPORTXML("https://www.youtube.com/watch?v=i1D8XIIvYS0","//div[#class='watch-view-count']")
I'd like to split out the YouTube ID into a different column and do the following where B2 is the cell with the value 'i1D8XIIvYS0'
=IMPORTXML("https://www.youtube.com/watch?v=B2","//div[#class='watch-view-count']")
How do I escape 'B2' so that the value is used here?
=IMPORTXML("https://www.youtube.com/watch?v="&B2,"//div[#class='watch-view-count']")
If your referencing b2 you just need to remove the quote from after it to in front of it and use the & to join the value with the string
Try:
=IMPORTXML("https://www.youtube.com/watch?v="& B2 &"","//div[#class='watch-view-count']")
Related
This is how my data looks(its some kind of Gantt). B column keeps the address and C column holds the value:
I want to use arrayFormula in C column. So that upon inserting new rows, the C column is filled automatically. Is that possible?
try in C3:
=INDEX(TRIM(FLATTEN(QUERY(TRANSPOSE(F3:J8),,9^9))))
From the solution in this page:
https://infoinspired.com/google-docs/spreadsheet/convert-cell-addresses-to-values-in-google-sheets/
You can use:
=ArrayFormula(transpose(split(TEXTJOIN("|",1,if(regexmatch(address(row(F3:F8),column(F3:I3),4),"^"&textjoin("$|^",true,B3:B8)&"$")=true,F3:I8,)),"|")))
Detailed explanation is on the web page.
Output:
I want to change the cell address to string/text. For example :
AB123 --> "AB123"
I want to use it with indirect(), for example to refer to A1:A100 where the '100' is fetched from cell X1 -->
indirect( to_string( A1 ) & ":A" & X1 )
I didn't do indirect("A1:A"&X1) because since "A1" is static string so when i insert a new row on the very top so to shift down row 1, then the formula won't update automatically and will still refer to A1:A100 , in fact it should now refer to A2:A100 after the row insert. In this case i want to keep the A1 not as string so after insert it should updated to A2
What is the simplest way to do it?
Try this:
=cell("address", AB123)
This (or something like it) might also work instead of all that "indirect" stuff.
OFFSET is very good at defining changing ranges like that.
=OFFSET(A2,,,X1,1)
try:
=INDIRECT(ADDRESS(123, COLUMN(AB1)))
or:
=INDIRECT(ADDRESS(123, 28))
to get range AB123
I have this situation on Google Sheets:
I want to concatenate (=A2&B2) with a merged cell, but only the first cell has a value. I want to get the values of the column "Expected results". How I can detect the first value of each work office in this example?
You can use INDEX/AGGREGATE:
=INDEX($A$1:$A$9,AGGREGATE(14,4,(ISBLANK($A$1:$A$9)=FALSE)*(ROW($A$1:$A$9)<=ROW())*ROW($A$1:$A$9),1)) & B2
Edit for google sheets:
=INDEX($A$1:$A$9,LARGE((ISBLANK($A$1:$A$9)=FALSE)*(ROW($A$1:$A$9)<=ROW())*ROW($A$1:$A$9),1)) & B2
When merging a cell, the content appears only as if it were if the first cell of that block. Hence, you need to only use that first value as your reference. For this you need to block the reference, and it would look like this:
=($A$1&B2)
You can check more information about that in this link.
Try this in D2:
=ARRAYFORMULA(IF(B2:B="",,VLOOKUP(ROW(A2:A),FILTER({ROW(A2:A),A2:A},A2:A<>""),2)&B2:B))
I've been toying with a few ways to do what I want to do, so I'll start with an example of my goal:
So, in the linked sheet, I have a table with colors and animals, and then a list of entries, each with a color and animal together. My goal is this: Take the string from one of the cells in column E, i.e. E2: Red Cat, and use that information to find the associated cell, and return either the cell reference B2, or the data contained where they intersect, in this case TRUE.
I opted for the cell content rather than the cell addresses. Please try:
=OFFSET($A$1,MATCH(INDEX(split(E2," "),1),A:A,0)-1,MATCH(INDEX(split(E2," "),2),$1:$1,0)-1)
If you alter a little bit code given by #pnuts then you will get cell reference:
=ADDRESS(MATCH(INDEX(SPLIT(E2," "),1),A:A,0),MATCH(INDEX(SPLIT(E2," "),1,2),$1:1,0),4)
The last paramether could be 1-4 and the results:
$B$2
B$2
$B2
B2
also you are able to add sheet name to reference, then it would be:
=ADDRESS(MATCH(INDEX(SPLIT(E2," "),1),A:A,0),MATCH(INDEX(SPLIT(E2," "),1,2),$1:1,0),4,,"SheetName")
and the result -> SheetName!B2
Maybe a good way to automate your task is to use array formulas:
The formula is F1 to split values:
=FILTER(SPLIT(E2:E," "),E2:E<>"")
The formula in H2 to get addresses:
=FILTER(ADDRESS(MATCH(F2:F,A:A,),MATCH(G2:G,1:1,),4),E2:E<>"")
or put this in H2 to get values:
=FILTER(VLOOKUP(F2:F,A:C,MATCH(G2:G,1:1,),0),E2:E<>"")
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?