How would one search for a string in a column and return its presence as a boolean in Google Sheets? - google-sheets

I would like to test for the presence of a string in a range(a column for this application), and return whether or not it is present as a boolean. How would I do this? I tried FIND and MATCH, but they didn’t work.

You can use the following formula:
=ARRAYFORMULA(SUM(IFERROR(SEARCH("string",A:A)))>0)
And if you want your search to be case sensitive you can use this one:
=ARRAYFORMULA(SUM(IFERROR(FIND("string",A:A)))>0)

Related

How to check multiple ranges for different values in Google Sheets

I'm trying to search 3 different ranges in a tab, and trying to display Yes if all three values (email address, name, x) are found in those ranges. Basically, trying to have the formula confirm that yes, all three of those inputs are somewhere in those ranges (order doesn't matter).
Maybe I should use query or regexmatch or something? Any help is appreciated
Tried this formula:
=IF(AND('Helper Calculations'!$I:$I=$A$1,'Helper Calculations'!$J:$J=L$1,'Helper Calculations'!$L:$L=$A2),"Yes","No")
Was expecting that if the search term in each of those cells ($A$1, L$1, $A2) is found somewhere in the corresponding ranges, then it would say Yes
You can try with this (you can change the use of asterisks by wrapping in AND:
=IF(COUNTIF('Helper Calculations'!$I:$I,$A$1)*COUNTIF('Helper Calculations'!$J:$J,L$1)*COUNTIF('Helper Calculations'!$L:$L=$A2),"YES,"NO")
try:
=INDEX(IF(('Helper Calculations'!I:I=A1)*
('Helper Calculations'!J:J=L1)*
('Helper Calculations'!L:L=A2), "Yes", "No"))
Took a bit more work than I expected, but I got this working. I needed to verify that all 3 values were correct in a single row (must all be correct on that one row, can't find the correct values on multiple rows).
In order to do that, I needed to use array formula, and then decided to use index match and concatenate for the 3 values.
Process described here: https://www.ablebits.com/office-addins-blog/google-sheets-index-match/
correct formula: =IF(ArrayFormula(INDEX('Helper Calculations'!$I:$I,MATCH(CONCATENATE($A$1,L$1,$A2),'Helper Calculations'!$I:$I&'Helper Calculations'!$J:$J&'Helper Calculations'!$L:$L, 0),))=$A$1,"Y"))

How to find earlier date in google spreadsheets?

in Google Spreadsheets I have a column A with dates and column B with specific values corresponding these dates:
A
B
10-Jan
51.1
11-Jan
49.2
14-Jan
50.3
If I find via VLOOKUP function the value of 11-Jan, it will work and show 49.2.
Off cause it won't work if I try to find a value of 13-Jan since it is absent from the list of dates. However, if the date is absent in column A I want to get the value of earlier date which is in the list (i.e. I want to get 49.2 corresponding to 11-Jan, if I use 13-Jan as the query for finding the value).
Maybe this type of search can be realized by using INDIRECT function, but I can't figure out the formula.
How do realize this?
Your problem can be solved by using vlookup only but with different parameter, if you indicate True for the last parameter, it mean the formula will try to return the closer match if it cannot found any result.
=arrayformula(VLOOKUP(E1:E5,A:B,2,True))

Last value of a column in Google Sheets

I was trying to use the following function;
=INDEX(D:D,COUNTA(D:D),1),
in order to get the last currency value of a column, but it returns #ERROR!.
The value im trying to extract
As I montly update this spreadsheet, it would make it very convenient if would etract the last value in the column, e.g. the value marked in the image.
Is there a way (in Google Sheets) to find the last non-empty cell in this column, such that when I update the spreadsheet with a new "last value" it would return that value?
The index(counta()) pattern will fail when the data is sparse, i.e., when there are blank values in the column.
The index(match()) pattern will fail when the data contains a value that is not a number.
To find the last non-blank value in column D, regardless of data type, use the +sort(row()) pattern:
=+sort(D1:D; not(isblank(D1:D)) * row(D1:D); false)
The formula uses semicolons as argument separators to make it work in any locale.
If the column has only currency (ie number) values then you can use something like:
=INDEX(D1:D, MATCH(999^99, D1:D))
or try:
=SORTN(D:D; 1;;ROW(D:D)*(D:D<>""); )

Google spreadsheet countif non empty cells except certain values

So basically i want to check if certain range of field is not blank or has a certain value
so
=ArrayFormula(COUNTIF(NOT(ISBLANK(H24:I28)), true))
will count if they are blank
How can i edit it to also search for a certain value so far i've tried :
=ArrayFormula(COUNTIF(NOT(ISBLANK(H24:I28)) OR(IFERROR(SEARCH("someValue",H24:I28,1)>0,FALSE)), true))
Here is a link to a sheet as an example:
https://docs.google.com/spreadsheets/d/1sc8xmLf8_EYFoQb3kNQRdxdd-9PemrJ4lDhTfIqCJNg/edit?usp=sharing
Update following OP's details:
Well i want to count every value except anything that starts with the word Empty basically
=COUNTIF(H24:I29,"<>") -
COUNTIF(ArrayFormula(REGEXMATCH(H24:I29,"Empty")),TRUE)
Functions used:
REGEXMATCH
ArrayFormula
COUNTIF
Initial answer
To find whether theValue exists or not, you can use the following formula:
=IF(COUNTIF(H24:I28,"<>")>0,IF(COUNTIF(H24:I28,"someValue")>0,"someValue","no value"),"empty")
To count how many times theValue exists, please use:
=IF(COUNTIF(H24:I28,"<>")>0,IF(COUNTIF(H24:I28,"someValue")>0,COUNTIF(H24:I28,"someValue"),"no value"),"empty")
(Of course you can adjust the "messages" to your liking)
Functions used:
COUNTIF
IF
You could use the OR() operator:
Example:
=ArrayFormula(OR(COUNTIF(NOT(ISBLANK(H24:I28)),true),IFERROR(SEARCH("someValue",H24:I28,1)>0,FALSE)))
References:
- OR() function

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