Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 months ago.
Improve this question
I had this formula working correctly in Excel, but when I'm trying to do the same in Google Sheets, it's not having it:
=TEXTJOIN(", ",1,FILTER(People2,ISNUMBER(SEARCH(People2,D2)),""))
I have used Exceljet, precisely as described here:
https://exceljet.net/formula/cell-contains-which-things
The formula tries to match words in my "dictionary" in People2 to words in cell D2, and lists all matching ones.
I have set up everything in name manager, works perfectly in Excel.
When I'm trying to do the same in Google Sheet, I get the following error:
FILTER has mismatched range sizes. Expected row count: 211, column count: 1. Actual row count: 1, column count: 1.
The only thing I'm doing differently is now I have the name range in a separate sheet.
I've found posts on how to fix this error, but none seem to apply to my scenario as my range is on a separate sheet.
Any ideas?
Using multiple cell formula
=ArrayFormula(IFERROR(TEXTJOIN(", ",,
TRANSPOSE(QUERY(TRANSPOSE(IFERROR(REGEXEXTRACT(IF(A2="",,SPLIT(A2," ")),{
TEXTJOIN("|",,QUERY({$D$2:$D}, "Where Col1 is not null"))}),"")),"where Col1 is not null "))),""))
Using Arrayformula
Note: for a simplified example checkout this question
=INDEX(REGEXREPLACE(TRIM(FLATTEN(QUERY(TRANSPOSE(IF(
IFERROR(REGEXEXTRACT(IF(A2:A="",,SPLIT(A2:A," ")),TEXTJOIN("|",,QUERY({$D$2:$D}, "Where Col1 is not null"))),"")="",,
IFERROR(REGEXEXTRACT(IF(A2:A="",,SPLIT(A2:A," ")),TEXTJOIN("|",,QUERY({$D$2:$D}, "Where Col1 is not null"))),"")&",")),,9^9))), ",$", ))
Related
This question already has answers here:
Stacking Multiple Arrays In Query/Lambda Function
(2 answers)
Closed 3 months ago.
First of all this is my first question here...
Ok, and now my problem:
I created a formula that generates a dynamic Query if you are searching for data in multiple sheets. I just write the names of the sheets in green field and it changes the Query.
The text for the Query is correct, but now I want this to by the actual formula in a cell to display the data.
If I use the = and add the cell with the Query text, it copy the text. I tried the INDIRECT formula, but it does the same.
How can I use a this dynamic text to be my Query to dispaly the data depending on the amount of names in the green field?
EDIT: As advised by user doubleunary (as mentioned, this is my first time), I'm going to rephrase the problem.
In an spreadsheet a manager imputs for every task the amount a worker has made. He creates an new sheet for each date and imputs the data for that day. Each day can have different rows of data. The boss wants a spreadsheet that display in one sheet all that has been done in the current month. I used Query because you can easy join data from multiple sheets and ignor the empty rows.
But the problem is, that every day a new sheet is added with a new "name" (date). And the easyest way I found tho make a dynamic Query, without the Boss to manualy edit the Query, was to create a text with TEXTJOIN formula, in witch he ony needs to enter the new "name" (date).
If there is a better was, please share, but it should not be in App Script if possible.
Thank you.
Easily you can't transform a text into a formula.
In this case, you should create the query formula and insert the ranges with Indirect function, like this:
=Query({Importrange(LINK,Indirect("'"&O4&"'!I38:S107"));Importrange(LINK,Indirect("'"&O5&"'!I38:S107"))},"Select * Where Col1 is not null",0)
If the formula you quote and the data sheets are all in the same spreadsheet file, you should not to use importrange() but indirect(), like this:
=query(
{
indirect(O4 & "!I38:S107");
indirect(O5 & "!I38:S107")
},
"where Col1 is not null",
0
)
In the event the row references such as I38:S107 change from time to time as well, you can put those references in a cell and refer to them the same way.
try (assuming url is same for all sheets):
=QUERY(LAMBDA(x, QUERY(REDUCE(SEQUENCE(1, 11), x,
LAMBDA(a, c, {a; IMPORTRANGE("url", c"!I38:S107")})),
"where Col1 is not null", 1))
(O4:INDEX(O:O, MAX((O:O<>"")*ROW(O:O)))), "offset 1", )
more examples: https://stackoverflow.com/a/74280310/5632629
This question already has answers here:
Query is ignoring string (non numeric) value
(2 answers)
Google spreadsheets query() is replacing text with null for mostly numeric columns [duplicate]
(3 answers)
Closed 5 months ago.
I am using query import range to pull through data from another spreadsheet which works apart from when a different type of value is needed eg. 1234 or
12345 would return correctly but values like this RIFG_PI9926 or COHJRI4426 are left blank.
I am thinking it is a formatting issue but playing around with format settings it makes no difference.
My next thought is to use the query to force results in the original format to see if that will allow them to pull through correctly.
This is what I have so far but returns blanks
=QUERY(IMPORTRANGE("url","Sheet!A2:L"),"select Col4,Col7,Col1,Col2, Col3,Col9",0)
Col7 is the problematic column
When I recreated a similar test it worked fine with the above formula which makes me think that is is definitely the formatting in some way
this is a know QUERY issue occurring whenever you have a mixed dataset (numeric number with text strings)
sometimes it's enough just:
=QUERY({IMPORTRANGE("URL", "Sheet!A2:L")},
"select Col4,Col7,Col1,Col2,Col3,Col9 where Col7 is not null", 0)
but mostly you will need to convert your dataset into one type:
=INDEX(QUERY(TO_TEXT(IMPORTRANGE("URL", "Sheet!A2:L")),
"select Col4,Col7,Col1,Col2,Col3,Col9 where Col7 is not null", 0))
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 months ago.
Improve this question
I know there have been many questions regarding this and I did read through these (+ the answers). But the formula suggested in each of them does not seem to work for me.
I have created a sheet for other people to look at, so that you all understand what I have been trying to do. I basically want my VLookup to search for the first 5 characters, but it's giving me an error. I used the formula that was suggested here in some other threads, but it doesn't seem to give any results.
Any help is much appreciated.
Use left(), like this:
=arrayformula( if( len(A2:A); iferror( vlookup( left(A2:A; 5) & "*"; F2:G; columns(F2:G); false) ); iferror(1/0) ) )
This array formula will automatically fill the whole column.
To do the same with a fill-down formula, remove the arrayformula() wrapper and use a row absolute reference, like this:
=vlookup( left(A2; 5) & "*"; F$2:G; columns(F$2:G); false)
See your sample spreadsheet for an illustration.
try in C2:
=INDEX(IF(A2:A="";;IFNA(VLOOKUP(LEFT(A2:A; 5)&"*"; F2:G12; 2; ))))
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I would appreciate some help with the following two scenarious which I presume you would use the split function, the two queries I have:
(1) How to split headers and data in each cell, imported data is displayed as follows:
I use =importxml(A1,F1)
A1 is the url:
https://www.tradingview.com/markets/stocks-australia/sectorandindustry-sector/communications/
and F1 is the Xpath:
//*[#id="js-category-content"]/header/div/div[3]/div/div
Imported data is displayed with data and header displayed together in the same cell as follows:
Col1 Col2 Col3 Col4 Col5
23Stocks 67.368BMkt Cap 19.335MVolume −1.26%Change −2.54%Perf Month
Col6 Col7
−3.98%Perf Year −4.61%Perf YTD
What I would like is to have it split into two rows, headers in first row, and related data in row 2. eg as follows:
Col1 Col2 Col3 Col4 Col5 Col 6 Col7
Stocks Mkt Cap Volume Change Perf Month Perf Year Perf YTD
23 67.368B 19.335M -1.26% -2.54% -3.98% -4.61%
(2) The second issue I have is how to extract text data when the imported data is seperated by two pipes.
I use =importhtml(A1,"table",11), A1 is: htps://www.finviz,com, the out put is: Consumer Cyclical | Auto Manufacturers | USA. The output I need is the text between the two pipes. How do I extract "Auto Manufacturers"?
Solution
You should get deeper inside the HTML structure in order to get only the row you need. now you are selecting an external div so the content will be squashed into a single cell.
Here is how to get only the headers for example:
//*[#id="js-category-content"]/header/div/div[3]/div/div/div/div[2]
I'm selecting the 2 element since in the HTML structure the headers are displayed below the values. I will use number 1 in order to get the values.
Once you got the information you need is time to build the table accordingly to your needs:
Since the output of the IMPORTXML is in a column I would use TRANSPOSE function to display it as a row:
A
1 https://www.tradingview.com/markets/stocks-australia/sectorandindustry-sector/communications/
2 //*[#id="js-category-content"]/header/div/div[3]/div/div/div/div[1]
3 //*[#id="js-category-content"]/header/div/div[3]/div/div/div/div[2]
.
.
.
10 =TRANSPOSE(IMPORTXML(A1,A3)) //Stocks Mkt Cap Volume Change Perf Month Perf Year Perf YTD
11 =TRANSPOSE(IMPORTXML(A1,A2)) //23 67.368B 19.335M -1.26% -2.54% -3.98% -4.61%
Reference
IMPORTXML
TRANSPOSE
This question already has an answer here:
How to use arrayformula with formulas that do not seem to support arrayformulas?
(1 answer)
Closed 4 months ago.
G'day people,
I am a long time supporter/reader but this is my first time posting on Stackoverflow so please bear with me.
Example of the Sheet I am working in
=if(E2="",,If(maxifs($E:$E,$K:$K,K2)=E2,K2,""))
I am a little stumped on converting this maxifs formula above that I am trying to convert to an arrayformula in Google Sheets. This formula checks to ensure E2 (timestamp) is not blank and then compares then looks all over the timestamp column for a newer timestamp for a distinct identifier (Column K example: '43909Ben Johns' (a CONCAT of a reference number and a client)) to see if there is a new version of that identifier. if it cannot find it, it will populate the row with the latest in column L (where the formula is situated) with the same identifier that is in Column K on the same row. If it does find a newer version it will populate with "".
I tried setting up an arrayformula however I could see that it wouldn't work as I was trying to convert it. It calculated the first row but left all other rows (about 10,000) blank and I suspect that is because it is trying to compare data on E2 and K2 with other rows in column E and K. Below is the array formula I tried:
=arrayformula(if(E2:E="",,If(maxifs(E2:E,K2:K,K2:K)=E2:E,K2:K,"")))
Any help to untangle this would be appreciated and if you need me to explain further, please let me know.
EDIT: Added Sample of Sheet https://docs.google.com/spreadsheets/d/1k1qK2BuYOwDPCtHedg7zV72JmE3_TQYu9EBwZVogQbU/
Kind Regards,
Ben
Here is a formula for you that can be placed in header cell (L1):
={
"Valid Check (Most Recent)";
ARRAYFORMULA(IF(E2:E = "",, IF(E2:E = VLOOKUP(K2:K, SORT({K2:K, E2:E}, 2, False), 2, 0), K2:K, "")))
}