Google Sheets: Finding a partial match - google-sheets

Right now I have the following in for conditional formatting:
=if(I43="Trait Dependency", False, IF(I43="None", False, if(isna(match(I43,B23:B40,0)),True, False)))
When its checking I43's value for a match in B23:B40 is there a way to check it for a partial match?
So lets say I43 = "Thing One or Thing Two" I want the sheet to check if any value in B23:B40 contains "Thing One" or "Thing Two" that way the formatting will return True if "Thing One" or "Thing Two" is present, but return false under other conditions
Current Sheet:
https://docs.google.com/spreadsheets/d/1-nR2J9a82ZDpOhWi0vee7LRxP03L96DYnML4Lawyw3g/edit#gid=1321754661
I took a few steps to simplify things for my benefit, but I'm still running into a wall. Right now, if I43 does not match any values in B23:B40 it changes the formatting as it should. I need it to check the value of I43 and J43 for formatting changes. Taking it a step further ideally it'll function as follows:
If I43 OR J43 do not match any values in B23:40, turn red.
If I43 AND J43 do not BOTH match any values in B23:B40 turn red.
Otherwise stay white.
I was just fiddling with the either/or part (I43 OR J43) and came up with
=if(I43="Trait Dependency", False, IF(I43="None", False, if(isna(match(I43,B23:B40,0)),True, if(isna(match(J43,B23:B40,0)),True,False))))
But that doesn't do what I need it to do. It seems to stop right after if(isna(match(I43,B23:B40,0)),True and doesn't do the last check

try:
=IF(I43="Trait Dependency", FALSE, IF(I43="None", FALSE,
IF((ISNA(MATCH("Thing One", B23:B40, 0)))+
(ISNA(MATCH("Thing Two", B23:B40, 0))), TRUE, FALSE)))
or:
=IF(I43="Trait Dependency", FALSE, IF(I43="None", FALSE,
IF(ISNA(MATCH("*"&I43&"*", B23:B40, 0)), TRUE, FALSE)))

Related

Google Sheets - Using Countif in an Array Formula - Return Text Value

Picture of Sheet
Hi,
I am trying to use an Array Formula on a Google Form Responses sheet - so the formula needs to be able to populate down for the whole column.
I am trying to count the number of "Yes" per row (max 4) and then if there are 4 return "Yes" (or "No" if there are not). The basic formula would be (and it works):
=if(countif(AA2:AD2, "Yes")=4, "Yes", "No")
However this will not work as an array formula for obvious reasons.
So far I have got the below to work:
=ARRAYFORMULA(if(row(A:A) = 1, "Test One", if(len(A1:A), COUNTIF(if(AA1:AD= "Yes", row(AA1:AA)), row(AA1:AA)),)))
However this returns a number and I still it to return the Yes/No if it is equal to 4 or not.
I have tried to put an if statement in various places to do this however I seem to break it every time.
Does any one please have any suggestions on how to make this work? I have attached a picture if this helps explain it!
Thanks!
When working with array formulas and results row by row, you can consider using BYROW. Try with:
=BYROW(AA2:AD,LAMBDA(each.IF(countif(each, "Yes")=4, "Yes", "No")))
If you want not to have "No" when there are empty rows you can do:
=BYROW(AA2:AD,LAMBDA(each.IF(COUNTA(each)=0,"",IF(countif(each, "Yes")=4, "Yes", "No"))))
This checks if there is any value in those four columns
Or use:
=BYROW(AA2:INDEX(AD:AD,MAX(ROW(A:A),A:A<>"")),LAMBDA(each.IF(countif(each, "Yes")=4, "Yes", "No")))
This limits the BYROW until the last column with values. Change A:A if needed with any column you know that will always be completed by the Form
try:
=INDEX(BYROW((AA2:AD="yes")*1, LAMBDA(x, SUM(x))))
to remove zeros:
=INDEX(BYROW((AA2:AD="yes")*1, LAMBDA(x, IFERROR(1/(1/SUM(x))))))
to return yes/no:
=INDEX(IF(Y2:Y="",,IF(Y2:Y=4, "yes", "no")))

Replacing the blank cells with specific value

I'm trying to change the blank cells into specific value of 16. However, the value it shows is like 44877. I tried changing the format, but it won't change.
The link is here: sample sheet
Thank you so much
Use isblank(), like this:
=arrayformula(
ifs(
isblank(A2:A), 16,
today() - A2:A > 1, today() - A2:A,
today() - A2:A < -1, 0,
true, iferror(1/0)
)
)
In the event the cells you call "blank" are actually not blank but contain a formula that yields zero-length text strings "", you need to consider that zero-length text strings are different from truly blank values.
To detect both zero-length text strings and truly blank values, replace isblank(A2:A) with not(len(A2:A)).
44877 is the dateserial value for today, 12 November 2022. See this answer for an explanation of how date and time values work in spreadsheets.
#doubleunary option works, obviously! As she/he suggested, the option where A is blank should be first. You're missing some scenarios: first you have >1 and <-1, if you want those values to be considered you should add an equal: >=1 <=-1
And also the one in which it is the same date as Today () -- so you should set first if A2:A is empty, then if it is equal, and then if its greater or smaller:
=ArrayFormula((IFS(isblank(A2:A), "16",TODAY()=A2:A, "Is today",TODAY()-A2:A>=1, TODAY()-A2:A, TODAY()-A2:A<=-1, "0")))
try:
=INDEX(LAMBDA(a, t,
IF(a="", 16,
IF(t-a > 1, t-a-1,
IF(t-a = 0, t-a,
IF(t-a < -1, 0, )))))(A2:A, TODAY()))

How to exclude multiple strings from SUMIFS

I have this formula here:
=SUMIFS(SalesData!$N:$N, SalesData!$B:$B, "FirstName LastName", SalesData!$D:$D, "<>"&A1:M1)
But the last part "<>"&A1:M1 doesn't work correctly. If I set it to a specific cell, e.g. "<>"&F1, that works fine. Is there a way to select the entire range of A1:M1?
try:
=SUM(FILTER(SalesData!N:N, SalesData!B:B="FirstName LastName",
NOT(REGEXMATCH(SalesData!D:D&"", TEXTJOIN("|", 1, A1:M1)))))

Mark duplicates in a column depending on the data in another column

I work in a recruitment call centre (not cold calling don't worry) and I'd like a way to highlight duplicate email addresses in one column of a google sheets spreadsheet. Basically I want them to highlight as one colour if the email is a duplicate but hasn't resulted in an interview, and highlight with another colour if the duplicate email is associated with an interview or rejection.
Here's what I'm thinking
I want the email from the "jack#gmail.com" address to be green since it is next to a "left message" notice, while the "cameron#gmail.com" should be red since it is next to a "Declined" notice.
I've already worked out the basics of using conditional statements and I'm using "=countif(A:A,A1)>1" to at least highlight the duplicates but I have no idea how to use information from column B to make a conditional.
Thanks!
You can achieve this by using a COUNTIF with VLOOKUP for the Conditional Formatting. Assuming your emails start at B2 and your statuses start at C2, you could use the following Conditional Formatting rules to get your desired behaviour:
=IF(COUNTIF(B$2:B, B2) > 1, IF(VLOOKUP(B2,B$2:C,2,False) = "Left Message", True, False), False)
=IF(COUNTIF(B$2:B, B2) > 1, IF(VLOOKUP(B2,B$2:C,2,False) = "Declined", True, False), False)
Here's a sample sheet I made just for you.
You can edit emails around and try it out yourself.

Cell Contains String with Relative Cell Reference Google Sheets

I have a sheet where I want to see if a column contains a certain String. If this is the case TRUE shall be returned, FALSE otherwise.
Here is what I tried, resulting in #VALUE!:
IF(SEARCH(A2, 'Dashboard Table'!A16:A), TRUE, FALSE)
What to do?
Thanks
Florian
The formula returns #VALUE! because IF requires a boolean value (0 is considered as FALSE, 1 or greater numbers are considered as TRUE) as the first argument, but SEARCH returns #N/A! if the text to search is not found, by the other hand SEARCH looks for the text on a cell value.
The following formula will return a array of TRUE/FALSE values, TRUE when the value of A2 is found, FALSE when not on cells A16:A:
=ARRAYFORMULA(IF(IFERROR(SEARCH(A2, 'Dashboard Table'!A16:A),FALSE), TRUE, FALSE))
To get a single TRUE when the text to searh is found on any cell on A16:A use
=ARRAYFORMULA(sum(IF(IFERROR(SEARCH(A2, 'Dashboard Table'!A16:A),0), 1, 0))>0)

Resources