Google Sheets - filter list excluding values from other list - list

I have a big sheet raw_data which is automatically populated by a script every 5 minutes. As such I cannot add new columns with formulas but have to solve problems in single formulas.
The challenge:
I need to pull out a list of unique values from a column O. At the same time, I need to filter out a certain set of values in range A55:A
I have this formula to pull out the unique values:
=SORT(UNIQUE(raw_data!O2:O))
I tried playing with match, but how do I "inverse" the result from the match as I'm actually looking to
exclude rather than include:
=SORT(UNIQUE(FILTER(raw_data!O2:O,IFERROR((Match(raw_data!O2:O,A75:A200,0))))))
I tried adding a NOT() around the Match() but that then gave me a no results error.
Anyone?

Instead of using NOT use ISNA
The above because MATCH returns #N/A when there is no match.
Related
Return FALSE for #N/A in if match statement
Filter out all of user's entries if one of them was selected

Related

Google Sheets - Issue with IFS statement using OR & AND returning TRUE/FALSE

This is the formula I am currently using:
=IFS(OR($C28="Sergeant First Class",$C28="Master Sergeant",$C28="First Sergeant",$C28="Warrant Officer",$C28="Junior Lieutenant"),AND(COUNTIFS('TRYOUT LOG'!$S:$S,$D28, 'TRYOUT LOG'!$D:$D, "TRUE",'TRYOUT LOG'!$T:$T,$C28),COUNTIFS('TRYOUT LOG'!$H:$H,$D28, 'TRYOUT LOG'!$D:$D, "TRUE",'TRYOUT LOG'!$I:$I,$C28)))
This returns "TRUE", but will return "FALSE" if the criteria isn't met. However, I want it to actually count the amount of times that the criteria is met, rather than just returning TRUE/FALSE.
I'll try to explain what exactly I want the formula to do.
I am currently checking if cell in C28 is a certain text, if they are then to count how many times this criteria appears in the 'TRYOUT LOG' sheet. I want it to check that column S on the Tryout Log matches D28, then for column D on the Tryout Log to match to "TRUE" and then for column T on the Tryout Log to match C28, then count how many that is all correct, and then ALSO (the AND statement) count how many times it appears in the other rows too, matching a similar criteria with just slightly different columns.
Essentially I need it to just check if a cell is = to a certain text, then count how many times 2 similar criterias are matched on the TRYOUT LOG sheet and return that amount.
Hopefully that all makes sense, if not I'm happy to answer any questions.
Any help is appreciated so thank you in advance.
Edited to include viewable link to the sheet
https://docs.google.com/spreadsheets/d/11-KJOgAZZvTO481wbqL1VR8hoSR02vCj-kHrJ619yVM/edit?usp=sharing

How to use Calculated Join in Tableau using 1-M relationship and regex_extract

Question 1 - Is Tableau able to use multiple results from from a single line in a REGEXP using the global variable to compare against another table during a Join operation? If no, question 2 is null. If yes...
Question 2 - I'm attempting to join two data sources in Tableau using a regexp in a calculated join because the left table has 1 value in each cell (ie. 64826) and the right table has 4 possible matches in each cell (ie. 00000|00000|21678|64826).
The problem is that my regex stops looking after it finds 1 match (the first of 4 values), and the global variable /g has the opposite effect I expected and eliminates all matches.
I've tried calculated joins on the Data Source tab. I've also tried separating those 4 values into their own columns in worksheets using
regexp_extract_nth. In both cases, regex stops looking after the first result. A Left Join seems to work somewhat, while an Outer Join returns nothing.
REGEXP_EXTRACT([Event Number],'(\d{5})')
REGEXP_EXTRACT_NTH([Event Number],'(?!0{5})(\d{5})',1)
With these examples, regex would match a NULL with the left table even though 64826 is in the right table. I expect the calculated join to return all possible matches from the right set, so there'd be a match on 21678 and on 64826, duplicating rows in the right table like so...
21678 - 00000|00000|21678|64826
64826 - 00000|00000|21678|64826
45245 - 45106|45245|00000|00000
45106 - 45106|45245|00000|00000
Your original expression is just fine, we might want to make sure that we are sending a right command in Tableau, which I'm not so sure, maybe let's try an expression similar to:
\b([^0]....)\b
even just for testing, then maybe let's modify our commands to:
REGEXP_EXTRACT([Event Number], '\b([^0]....)\b')
or:
REGEXP_EXTRACT_NTH([Event Number], '\b([^0]....)\b', 1)
to see what happens. I'm assuming that the desired numbers won't be starting with 0.
Please see the demo here
Reference

REGEXMATCH and MATCH don't work when a cell contains a number

I am trying to use formulas to find a row in my google spreadsheet document, however I have got a weird problem.
I am not able to find values when a cell contains a number (without any other characters).
Consider the following case
I have got two values
A1 - 32323232323
A2 - 323-23232-323
When I use the following formula
=FILTER(A:E,REGEXMATCH(B:B,"323-23232-323"))
It works fine, it successfully finds A2 value, however when I try to use the following formula
=FILTER(A:E,REGEXMATCH(B:B,"32323232323"))
It doesn't match any row, and I also tried the following formula
ADDRESS(MATCH("32323232323",B:B,0),1)
It doesn't work either, it only works when I remove quotes like that
ADDRESS(MATCH(32323232323,B:B,0),1)
But this doesn't work with REGEXMATCH.
Is there any way I can match numbers using a regex expression (exact number, without wildcards) ?
Thanks
=FILTER(A:A,REGEXMATCH(REGEXREPLACE(TO_TEXT(A:A),"-",""), "32323232323"))
to get both 323-23232-323 and 32323232323.
=FILTER(A:E,REGEXMATCH(TO_TEXT(B:B),"32323232323"))
to get number 32323232323.
Notes:
Converting to_text is a key here.
Change columns to yours.

How do I apply a formula to a range without applying said formula to every cell?

I'm trying to apply a formula without having it add the formula data to each and every cell - in other words, I need the cells that are receiving the formula to be untouched until they get their data.
I was searching around and it looked like an ARRAYFORMULA would work but it doesn't seem to be doing anything when I apply it.
For example, I want to apply this formula to a cell range: =SPLIT(E2, ",")). Each cell in the E column needs to be split into two the two adjacent cells next to it based on it's comma. When I try to apply =ARRAYFORMULA(SPLIT(E2:E99, ",")) only the cell I add this to gets the formula.
In addition to the contribution of pnuts, also try:
=ArrayFormula(iferror(REGEXEXTRACT(","&E2:E,"^"&REPT(",+[^,]+",COLUMN(OFFSET(A1,,,1,6))-1)&",+([^,]+)")))
Note: the last parameter of OFFSET can be changed to match the maximum number of values you have in the cells of the range E2:E (separated by a comma). E.g: if you have a no more than 3 values per cell, set it to three. The output will then be three columns wide (one column for each value).
Hope that makes sense ?
Also credits due to AdamL who (I believe) orginally crafted this workaround.
I think what you want may be array_constrain but for your example I can only at present offer you two formulae (one for each side of the comma):
=Array_constrain(arrayformula(left(E2:E,find(",",E2:E)-1)),match("xxx",E:E)-1,1)
=Array_constrain(arrayformula(mid(E2:E,find(",",E2:E)+1,len(E2:E))),match("xxx",E:E)-1,1)

Conditional Vlook up without using VBA

I want to convert an input to desired output. Kindly help.
In the output - the columns value should start from most recent (year)
Please click this to see data
Unfortunately VLOOKUP is not able to fulfill that ask. However the INDEX-function can.
Here is a good read on how to use it:
http://fiveminutelessons.com/learn-microsoft-excel/use-index-lookup-multiple-values-list
This will work for you spreedsheet, if your input table starts at A1 without a header and your output table starts at H3 with the first ID.
You get this by copy&pasting the first column of your input table to column H and then remove duplicates.
{=IF(ISERROR(INDEX($A$1:$C$7,SMALL(IF($A$1:$A$7=$H$3,ROW($A$1:$A$7)),ROW(1:1)),3)),"",
INDEX($A$1:$C$7;SMALL(IF($A$1:$A$7=$H$3,ROW($A$1:$A$7)),ROW(1:1)),3))}
Let's look at the formula step by step:
The curly brackets tell excel that this is an array formula, the interesting part for you is: when you've inserted the formula (without curly brackets) press shift+ctrl+enter, excel will then know that this is an array formula.
'error at formula?, then blank, else formula
=IF(ISERROR(....),"",...)
When you autofill this formula you probably dont know how many instances of your lookup variable are. So when you put this formula in 4 cells, but there are only 3 entries, this bit will keep the cell blank instead of giving an error.
INDEX($A$1:$C$7,SMALL(IF($A$1:$A$7=$H$3,ROW($A$1:$A$7)),ROW(1:1)),3))
$A$1:$C$7 is your data matrix. Your IDs (in your case 125 and 501) are to be found in $A$1:$A$7. ROW(1:1) is the absolute(!) rowID, 3 the absolute(!) column id. So when you move your input table those values have to be changed.
What exactly SMALL and INDEX do are well described in the link above. (Or at least better than I could.)
Hope that clarified some parts,
Tom