Cell Contains String with Relative Cell Reference Google Sheets - 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)

Related

Trying to convert 1 condition to 2 conditions

I currently have the following formula in A3:
=iferror(if(A1="","",1),0)
I want to change it so that this logic remains the same but A2 should also be checked to make sure it is False. If A2 is false, the same logic of the formula above should apply when it is false.
If A2 is true, it should behave the same way as the logic above, when it is true.
I'm having trouble properly converting this :-/
I was trying it with =AND but got confused how to make sure that the same logic applies as the check above when A2 is False and True respectively.
Iferror only checks if the entire expression returns an error, not a cell by cell. To get what you want, you should modify your condition to simply check for an error in cell a1 or a2, and then write your if statement based on that. Assuming you want a 0 if either cell has an error, then this should work: =if(Or(ISERROR(A1),ISERROR(A2)),0,if(A1="","",1))
try:
=IFERROR(IF((A1="")*(A2=FALSE),, 1), 0)
which reads as: if A1 is empty and A2 equals false output empty cell otherwise output 1 and if any kind of error occurs output 0

IF statement returning FALSE/TRUE instead of a number value

Hello I am having trouble getting this formula to work. It keeps returning false.
My "I" column retains a text value of either "PUSH", "WIN", "LOSS".
Depending on that value i want to be able to calculate the units.
Column "E" retains the units value which correspond with the bet value of Column "F".
Column "H" is the column I am trying to calculate the win/loss function.
=IF(I10 = "WIN", H10=(G10/200), IF(I10 = "LOSS", H10=(E10*(-1)), IF(I10 = "PUSH", H10=0)) )
Screenshot of my spreadsheet
Issue:
IF function parameters are as follows: IF(logical_expression, value_if_true, value_if_false). This means that:
If logical_expression returns TRUE, current cell is set to value_if_true.
If logical_expression returns FALSE, current cell is set to value_if_false.
In this case, you are assigning value_if_true to a condition (H10=(G10/200)), and value_if_false to one of these possible conditions (H10=(E10*(-1)), H10=0). Conditions return TRUE or FALSE, and that explains the behaviour you are getting.
I think your confusion comes from the belief that you need to specify which cell you want to write the value to, when IF already writes to the current cell (the cell where the formula is written).
Solution:
=IF(I10 = "WIN", G10/200, IF(I10 = "LOSS", E10*(-1), IF(I10 = "PUSH", 0) ))
Reference:
IF function

Why does ISBLANK return False not see a blank cell but COUNTBLANK does in Google sheets

I am trying to check if a column is blank. The column is formatted as plain text, so I understand that causes the ISBLANK formula to return false, regardless of what is in the cell. But If I use COUNTBLANKS on the same range, it counts text cells as blanks. Is there not an easy way to check if no values (numbers or text) appear in a column. Here is an example here.
The documentation of isblank indicates that this command is meant for one cell only (it's not named areblank, after all). Confirmed by trying the following in a new spreadsheet: =isblank(A1) is True, =isblank(A2) is True, but isblank(A1:A2) is False, simply because A1:A2 is not a single blank cell.
If you want to check whether a given column (like C2:C10) is empty, countblanks is one option, and another is comparing =sum(len(C2:C10)) to 0. The latter method treats empty string "" same as blank cells.

Can I filter data in Google Sheets using a condition like not in range?

I'm trying to use Query Language in Google Sheets, but only select data that is not in a range.
I'm able to do that for a specific field, but I'd like to know how to do for a specific range.
May be we can figure-out what is going wrong with your code, if you provide.
The syntax for filter is
FILTER(range, condition1, [condition2, ...])
range - The data to be filtered.
condition1 - A column or row containing true or false values corresponding to the first column or row of range, or an array formula evaluating to true or false.
condition2 ... - [ OPTIONAL ] - Additional rows or columns containing boolean values TRUE or FALSE indicating whether the corresponding row or column in range should pass through FILTER. Can also contain array formula expressions which evaluate to such rows or columns. All conditions must be of the same type (row or column). Mixing row conditions and column conditions is not permitted.
condition arguments must have exactly the same length as range.
Sample Usage
FILTER(A2:B26, A2:A26 > 5, D2:D26 < 10)
FILTER(A2:C5, {TRUE; TRUE; FALSE; TRUE})
FILTER(A2:B10, NOT(ISBLANK(A2:A10)))
https://support.google.com/docs/answer/3093197?hl=en

How does this formula to return the last value in a column work?

This is a formula which returns last value in a column:
=INDEX(A:A;MAX((A:A<>"")*(ROW(A:A))))
Can't understand how it works because the part MAX((A:A<>"")*(ROW(A:A))) returns 0.
Any ideas?
For the sake of an answer. The segment:
=MAX((A:A<>"")*(ROW(A:A)))
returns 0 if the row it is in has a blank cell in ColumnA, otherwise 1.
As an array formula (Ctrl+Shift+Enter before Enter) to get:
=ArrayFormula(MAX((A:A<>"")*(ROW(A:A))))
returns the row number of the last populated cell in ColumnA.
Simplifying this to an example of three rows with the first (Row1) blank:
the 'not blank' part returns an array of: FALSE,TRUE,TRUE
and the ROW part of 1,2,3
so multiplying (the *) these together gives an array 0,2,3 (multiplying by FALSE is equivalent to multiplying by 0 and by TRUE equivalent to times 1).
The MAX function then selects the largest value (3).
The INDEX function then 'reads' the above to return the value in ColumnA in that last (third) row.

Resources