So some agency want to know how many users are allowed to get into their system they send me all users that are allowed, now i want match every user with their data, if the user exit in their column then write "TRUE" if not "FALSE"? Thank you.
Names
Agency1
Allowed?
user565
user44
FALSE
user4851
user4
TRUE
user548
user3
FALSE
user4
user884
FALSE
You should be able to accomplish this using MATCH. Something like:
MATCH(C2,B$2:B)
Note that I am using B$2 here. This means that when you copy this formula to each row, it will continue to look at all of the values in xolumb B. So this is only the formula for the first row.
If MATCH does not find the result, it will return #N/A. This can be handled with IFNA:
IFNA(MATCH(C2, B$2:B), FALSE)
This will return FALSE if the MATCH returns #N/A
Now, to get your TRUE/FALSE value, you need to do a comparison of the above:
IF(IFNA(MATCH(C2, B$2:B), FALSE), TRUE, FALSE)
use:
=INDEX(IFNA(MATCH(B2:B5; A2:A5; ))>0)
Another alternative is to use COUNTIF.
=ArrayFormula(countif(A2:A5,B2:B5)>0)
Related
Google sheets issue. I want a formula that will return TRUE or FALSE if two conditions are met. However for one of the conditions there are two possibilities.
IF A2="Pizza OR Banana" AND B2="Food" then return TRUE
How can I go about it? For now I did the following but I am missing one option (banana):
=IF(AND($A2="Pizza"),$B2="Food")
Thank you!
You could use a formula like
=IF(AND(OR(A2="Pizza", A2="Banana"), B2="Food"), TRUE, FALSE)
Edit:
As pointed out by MattKing, you don't need the IF here at all since AND will give you TRUE/FALSE, you can just use:
=AND(OR(A2="Pizza", A2="Banana"), B2="Food")
try:
=((A2="Pizza")+(A2="Banana"))*(B2="Food")
What if I wanted it to not be case sensitive and to work with Food-FOOD-food and other variants?
=AND(REGEXMATCH($A$2,"(?i)^pizza$|^banana$"),REGEXMATCH($B$2,"(?i)food"))
Use REGEXMATCH instead gives you more control on the conditions.
In this example,
the first REGEXMATCH will do non-case-sensitive check on A2 to see if it is a word started with 'p' end with 'a' spell as 'pizza' or started with 'b' end with 'a' spell as 'banana' (if anything is added before or after 'pizza' and 'banana', such as 'ppizzaa', it returns false),
the second REGEXMATCH do non-case-sensitive check on B2 to see if it is any variants which includes 'food' (even something like 'xFooDy' will return true).
Question is pretty self explanatory. I have two columns (num1, num2) and I just want to return the values that do not match (and not the others):
So the ideal return is simply 2,3,4,5
Edited for clarity**
use:
=FILTER(FLATTEN(A2:B), COUNTIFS(FLATTEN(A2:B), FLATTEN(A2:B))=1)
or if you want it sorted:
=SORT(FILTER(FLATTEN(A2:B), COUNTIFS(FLATTEN(A2:B), FLATTEN(A2:B))=1))
or if you want it joint:
=TEXTJOIN(", ", 1, SORT(FILTER(FLATTEN(A2:B), COUNTIFS(FLATTEN(A2:B), FLATTEN(A2:B))=1)))
You could also use the optional [exactly once] argument of UNIQUE to achieve the same thing in this particular context:
=unique(flatten(A2:B),,1)
This can then be sorted/joined if required.
I am trying to do the following:
From an array [true, true, false] I want to find the number of occurrences of the value true.
I use the collect() to gather the true/false values.
I can check the existence with is in but can't count.
Should I unwind?
For every article I want to get the suggestions in the relationship r. Then If it is more than 3 suggestions, I want to set a property in article to be reviewed: true, otherwise false.
MATCH (a:author)-[r:reviewedby]-(ar:article)
WITH ar, collect(r.suggest) as suggestions
WITH ar, size(suggestions) as nb_sug,
RETURN ar, nb_sug
If you are not making use of false suggestions, for example to calculate a ratio of true/false , this should work.
MATCH (a:author)-[r:reviewedby {suggest:true}]-(ar:article)
WITH ar, count(r) as true_suggestions
WHERE true_suggestions >= 3
RETURN ar
Is there any way that I can get the true value of an OR operation? Something like this?
=OR(value1, value2, value3) return value that is true
try:
=OR(value1, value2, value3)=TRUE
example:
=OR(A1=1, A1=2, A1=3)=TRUE
Taking this question's title literally, the value of any true Or function is always True. However that's probably not what OP is seeking but there's a fundamental misunderstanding that an Or function can have values. Specifically, this question makes a nonsensical assumption that an OR function can have value1, value2, value3. An Or function contains evaluations that return true or false -- no third value possible.
To illustrate, what value would be returned from this Or formula?
=Or(Not(Isnumber(A1)),len(A1)<5,left(C1,1)="G")
However, I understand that this is probably specific to some customized situation. The solution is that some other formula, functionality is needed. If you're evaluating a single cell (i.e. if cell A1 has any three values), then Erik Tyler's proposal of just using an if statement is your answer
=ArrayFormula(IF(OR(A1={5,10,15}),A1,))
(a less elegant but simplified formula that returns the same would be: =if(Or(A1=5,A1=10,A1=15),A1,)
For finding some true values in a range, there are all kinds of possibilities. However to get you started, you might consider using a filter function combined with boolean logic of (evaluation1)+(evaluation2).
See below formula will list off cell addresses of all true values in this Filter function.
=FILTER(Address(ROW(A:A),COLUMN(A:A),4),(A:A=3)+(A:A=5)+(A:A="Hello"))
I am trying to create a filter function based on a condition, but when the condition is false I receive the error saying that the array returns empty rows.. Anything I can do?
={IF($C5,SORT(FILTER($AE3:$BL,$AF$3:$AF=$D5),1,TRUE),"");
IF($C6,SORT(FILTER($AE3:$BL,$AF$3:$AF=$D6),1,TRUE),"");
IF($C7,SORT(FILTER($AE3:$BL,$AF$3:$AF=$D7),1,TRUE),"");
IF($C8,SORT(FILTER($AE3:$BL,$AF$3:$AF=$D8),1,TRUE),"");
IF($C9,SORT(FILTER($AE3:$BL,$AF$3:$AF=$D),1,TRUE),"");
IF($C10,SORT(FILTER($AE3:$BL,$AF$3:$AF=$D10),1,TRUE),"")
}
You might try this formula:
=QUERY(AE3:BL,"where AF matches '"&JOIN("|",FILTER(D5:D10,C5:C10))&"' order by AF,AE",0)
or this if you prefer, but just didn't know how to ask:
=QUERY(AE3:BL,"where AF matches '"&JOIN("|",FILTER(D5:D10,C5:C10))&"' order by AE",0)