I'm trying to get the below formula to copy down column D (in red) and have the same results as column E (in green)
={"Query in H1";ARRAYFORMULA(IF(B2:B<>"",(IF(ISNUMBER(SEARCH(B3:B,IMPORTXML(A2:A,"//h1"))),"Yes","No"))))}
This formula collects the H1 (xpath) via the IMPORTXML function of the URL (column A) and checks to see if the keyword (column B) is included. If it is "Yes" if not "No"
See Google Sheet for reference:
https://docs.google.com/spreadsheets/d/1iHkU-rNtNhoOKvW_CWY7WU5OLsMFVqEFNRZlx_R-7RY/edit#gid=1497887942
Your formula just needs a few modifications:
Remove the header text and modify the SEARCH parameters to B2:B such that the formula looks like this:
=ARRAYFORMULA(IF(B2:B<>"",(IF(ISNUMBER(SEARCH(B2:B,IMPORTXML(A2:A,"//h1"))),"Yes","No"))))
Place the formula in the D2 cell.
After all the changes, this is how your sheet will look like:
I have also taken the opportunity to create a copy of the sheet named Answer with all the modifications.
As far as I know, we can not use ImportXML with ArrayFormula, the result after run formular will not correct. Even you see the result run down from the top to the last column, but the result will be wrong.
You can see an example in the screenshot below, with the same URL, the results in Column F and I are different from each other.
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)}
Working with the Base and Data tabs from this sheet: https://docs.google.com/spreadsheets/d/1OsSWQ_48VrcTU3pXGeJ_1syluKPVeVRune39UA9I3x4/edit?usp=sharing
Expected result is textjoin of all colors matching SKU separated by comma in column C on Base tab.
Expected result shows in Column D, done manually.
All formulas i've tried either put everything in one cell (C2), gives an N/A error(C4), just pulls the first result (C5) or it is just completely blank.
Please help? If you cannot, then thank you for reading anyway.
I did it on a new Sheet on the Spreadsheet that i took the liberty to create (hope it's ok)
For getting the colors I used QUERY: so it came out as QUERY(Data!B:G,"select G where B = '"&A2&"'". After that I just fed that to your JOINTEXT formula
I have a following formula in my google sheets
=TEXTJOIN(" -- ",TRUE,QUERY('sheetName'!B2:F,"SELECT F WHERE B = '"&$A3&"'"))
The formula is in a different sheet, same workbook though, let's call it "sheetResult". Basically it looks-up values and returns them if there is a match. There are two things I would like to achieve with it further. I need it to be an array so that it applies to all of the rows and I need it to return only the unique values found, I have tried the following but it does not work.
=ARRAYFORMULA(IF(A2:A = "" , , TEXTJOIN(", ",TRUE,UNIQUE(QUERY('sheetName'!B2:F,"SELECT F WHERE B = '"&$A2&"'"))) )) --> not sure what syntax to use
I tried filter but filter just returns all of the info stacked up, need the formula to return the data considering the rows in which the lookup value is held.
EDIT: Added a link to shared file to better describe the question.
I want to make the formula in Y3 on the "Students" sheet apply to all of the cells below it, much like an array formula does.
Example
After further studying your situation I came with a simple fix based on your original formula. I understand that you want to apply the Y3 formula to the whole table, but without altering its behaviour. I assume that the only moving part would be the students ID (Column A). Then you only need to modify your formula to lock the fixed variables with something like:
=TEXTJOIN(" -- ",TRUE,UNIQUE(QUERY('.data'!$B$2:$F,"SELECT F WHERE B = '"&A3&"'")))
After you write that on Y3 you would need to select it and drag it down to fill the table. Please leave a comment if you need further help.
This question pertains to Google Sheets. In column F of one "List" tab of my sheet, I have the name of all the other tabs in my sheet. All the other tabs contain information specific to one single topic. Im trying to get all of column N in "List" to pull up cell G2 of each sheet. So far, ive been using this:
='(sheet name)'!G2 ;in the N column, changing (sheet name) manually and individually
But I'd rather have the content of the F fill the (sheet name) part of the formula. Any way to do so?
With sheet names in column F, in N1 enter:
=INDIRECT("'" & F1 & "'!G2")
and copy down. Please note the single quotes in the formula.
This should work for both Excel and Google Sheets.
How do I copy data from one cell of a column to next cell of next column if the data is greater than 2 by using formula?
Now my file is like this:
I want to transfer the data from column B to column C, whose value > than 2.
So, the sheet will be like this:
Please help me to solve this... Thank You.
You can copy the values over if they are greater than or equal to five, but moving them is not something you can do with a custom function, you would need apps script running to do that for you.
Here is what you can do: =IF(B2 > 2, B2, "") , this will copy the value over if its > 2. Just drag this formula down the sheet.
I have also added basic conditional formatting to highlight it as red.
Example Sheet
try this formula:
=ArrayFormula(
{sheet1!A2:A,
if(sheet1!B2:B<=2,sheet1!B2:B,""),
if(sheet1!B2:B>2,sheet1!B2:B,"")})
use it in separate sheet to convert existing table(1) to result table(2) from yuor example.