Separate text only up to the sixth bar in the value - google-sheets

For values of this type:
https://int.testlink.com/international/europe/uefa-cup/20212022/3rd-qualifying-round/r63669/
I use this formula:
=ARRAYFORMULA(REGEXEXTRACT(A1:A,REGEXREPLACE(A1:A,"(https?:\/\/([\w.-]+\/){4})","($1)")))
To retrieve this type of value up to the sixth bar:
https://int.testlink.com/international/europe/uefa-cup/
But for this type of value it contains #### and $$$$:
https://int.testlink.com/national/scotland/third-division/####/regular-season/$$$$/
The result is an error, I would like to know how I should modify it to carry out the collection that deviates from the issue of special symbols.

Try:
=ARRAYFORMULA(REGEXEXTRACT(A1:A,REGEXREPLACE(A1:A,"(https?:\/\/([\w.-]+\/){4}).*","($1)")))

Related

How can I find the name of the person ranked 1?

What I'm trying to do is find the name of the person who is ranked number 1 in the table shown below. I have tried =LOOKUP and =VLOOKUP but I get an error saying that a result can't be found, even though it's obviously there. I assume that I'm either using the wrong function or just not using it right.
I tried =VLOOKUP(1;D2:H19;1) and =LOOKUP(1;D2:H19;1) but neither seems to work.
Answer
The following formula should produce the behaviour you desire:
=INDEX(D2:D,MATCH(1,H2:H,0))
Explanation
=VLOOKUP can only be used to find values to the right of a search key. To find values to the left of a search key, use a combination of =INDEX and =MATCH.
The =MATCH function searches a specified range for a specified value and returns the relative position of the value in that range. In this case, the value to search for is 1, the range to search through is H2:H, and the 0 at the end specifies that the range is not sorted in any way.
The =INDEX function returns the contents of a cell within a range having a specified row and column offset. In this case, the range is D2:D, and the row is whichever row is returned by =MATCH. =INDEX could take a third argument if it was desired to specify a row offset as well, but that is not necessary here.
Functions used:
=INDEX
=MATCH
You sort your ascending order based on rank then return your desired data using INDEX() function. Try-
=INDEX(SORT(D2:H500,5,1),1,1)
=vlookup(1,{H2:H19, D2:D19},2)
Since vlookup only searches the 1st column of the input range, to use it, you need to flip the columns by composing a local array: {H2:H19, D2:D19}.
{} means concatenation. , in it means horizontal concatenation. With that, the rank column is now the 1st column in the input of vlookup and now vlookup works.
With our local array, the 2nd column are the names and therefore index should be 2.
Also note the use of comma to separate function inputs.
your VLOOKUP formula should look like:
=VLOOKUP(1, {H2:H19, D2:D19}, 2, 0)
also try just:
=FILTER(D:D; H:H=1)
or:
=SORTN(D:D; 1; 1; H:H; 1)
You can use query (usefull in case of ex aequo)
=query(D2:H,"select D where H=1",0)

Google Sheets: How do I create an array from a range, adding a column with a constant literal value in every row?

I want to make an array with several columns. The second and subsequent columns are specified as a range pulled from another sheet. The first column is a static constant, that is, every cell in the first column should have the very same literal string value, say 'foo'. I can't find the correct syntax. I'd have thought something like this would work:
={"foo", 'Other Sheet'!C2:F}
but I get "Function ARRAY_ROW parameter 2 has mismatched row size. Expected: 1. Actual: 999." Clearly "foo" needs to be "expanded" to a column with lots of rows. How do I do it, and where are tricks like this documented?
Maybe the answer to this question would give a start: How do I create an array containing a single column, every cell containing "foo", with the number of columns specified by a different range?
Here is an editable sheet illustrating the problem and the desired solution:
https://docs.google.com/spreadsheets/d/17myzKVFN3SDQuubWNdP-dFAbdvdlRbZFkjRpLi2Fas8/edit?usp=sharing
The exact question is this: what formula can I put in cell B9 of Sheet1 to get the current appearance of Sheet1? Notice that I don't know in advance how many rows there are in 'Other Sheet'. It's OK to assume that all rows of Other Sheet have a nonblank value in column C.
You can loop with an arrayformula and assign them to the first column, ending the array with the same size:
={ARRAYFORMULA(if(len('Other Sheet'!C2:C),"foo",)),'Other Sheet'!C2:F}
Side note: that between the {}, if you put a comma ({expr1 , expr2}), the value will be side by side, and if you put a semicolon ({expr1 ; expr2}), the values will be one above the other.
You can use QUERY for that:
=QUERY('Other Sheet'!C2:F, "select 'foo',C,D,E,F where C is not null")
If you want to remove the 'foo' column header, you can use:
=QUERY('Other Sheet'!C2:F, "select 'foo',C,D,E,F where C is not null label 'foo' ''")

How do I write a "formula" in the Google Sheets filter widget?

I know I can do this with formulas, but I'd like to understand how to do it using the popup filter tool (since I'm constantly changing it).
This thing, for reference:
Ordinarily, I can get away with entering the string I want in the "Value or formula" window, like so...
The above works AS LONG AS the exact string I type matches a sub-string in the cell. However, every now and then I want to do something like this...
But that doesn't work.
I've tried all sorts of "formulas", like "foo" && "bar" or ="foo" + "bar"
But of course those don't work either... It doesn't seem to make sense to use the =filter(...) formula, as that requires a range that is already defined by the filter widget itself. I haven't had any luck with that either.
Can anyone give me an example of (or a link to) an AND search 'formula' I can type into that window that would actually include all of the following 'cells':
foo bar
foo banana bar
bar foo
this foo that bar
And in case others find this question, it might be nice to see an OR search formula as well
Custom Formula:
=REGEXMATCH(A1,"(?iU)(foo.*bar)|(bar.*foo)")
Apply to A1:A5
Click here
OR Logic
Hardcode the list
You may try custom formula:
=ISNA(MATCH(A2,{"foo", "bar", "banana"},))=false
You may add any number of items inside array { } in double quotes: "that", "boo", ...
Add the list into separate column
I've added a list in column G:
foo
bar
banana
and then applied the formula:
=ISNA(MATCH(A2, G:G ,))=false
The filter did not adjust when I added values in col G, I needed to click on the filter and OK button to refresh it.
AND Logic
For and logic regex may be handy, as #i-i has suggested.

How to get the address/reference of a cell based on a filter Google Sheets?

Background
Suppose I would like to filter a column for a cell that contains the text "onboarding". As soon as I get that, I want to use OFFSET to get the corresponding value in the I column as depicted below
Question
How do I get the reference of a cell that is outputted as a result of a filter? For example I would run this command
=filter(data!C1:C100,data!C1:C100="onboarding")
But then I want to get the reference of the result (right now it just returns the string "onboarding") and feed it to the OFFSET method, which expects a cell_reference as a parameter
OFFSET(cell_reference, offset_rows, offset_columns, [height], [width])
Short answer
To get a cell reference relative to a filter result, try
=INDIRECT(INDEX("I"&filter(ROW(data!C1:C100),data!C1:C100="onboarding")),1))
Explanation
ROW(data!C1:C100) returns the row number for each cell in the referred range
FILTER will return the corresponding values to the criteria.
& concatenates I as the column ID with the values returned by filter.
INDEX is used to force only one result1.
INDIRECT converts the reference string to a reference that could be used by OFFSET or other functions that require a reference as argument.
1: The use of INDEX is optional as INDIRECT only will return one reference. If INDEX is omitted, the reference will be related to the first value returned by FILTER.
this worked for me.. but i'll award correct answer to reference answer
=vlookup($A$2,data!$C$1:$I$100,7,false)
If you just want the values from I that has Onboarding in C then use:
=filter(data!I1:I100,data!C1:C100="onboarding")

format rows in google sheets based on conditional range

I have a data set with 77 rows. One of the columns (let's call it C) contains a name value. I would like to highlight the row if the name in column C is found in a list of names in another column.
Currently, I'm able to check only a single value, instead of a list of values. In conditional format rules, I'm able to enter the following formula
=$C:$C=$GU$1
This, of course, only checks the value against the first name in column GU. I tried to add :$GU$100 to the condition, but that won't work as the condition is now checking if the entry is the same as the entire value from GU1:GU100.
I thought I might try to use a FIND() method to see if the substring were in the larger string. To do that, I attempted the following:
=$C:$C=IF(ISNUMBER(FIND($C$1,$GU$1:$GU$100)),1,0)
While this did not return an error, it also did not highlight any rows. I'm unsure how to format one row based on whether or not the value in that row is an entry in a list elsewhere. Any ideas?
Please select your 'entire row' range (here assumed ColumnsA:G) and Format, Conditional formatting..., Format cells if..., Custom formula is:
=match($C1,$H:$H,0)
choose your Formatting style and Done. Where ColumnH is assumed to have your list.
You can add conditional formatting like this with the custom function option and applying to column C, pretending that the list with names your matching against is in column J:
=IF(ISTEXT(VLOOKUP(C1:C,J:J,1,false)),TRUE,FALSE)

Resources