if column not include some word - google-sheets

if column not include some word
I use this filter but not working:
=if(NOT(REGEXMATCH(A1:A6,"boy")),"")
But it works if I use just one row like that:
=if(NOT(REGEXMATCH(A1,"boy")),"")
return empty cell
I want to search in hole column A in has text boy and return empty cell

use:
=ARRAYFORMULA(IF(NOT(REGEXMATCH(A1:A6; "boy")); )
or:
=ARRAYFORMULA(IF(NOT(REGEXMATCH(A1:A6; "boy"));;"xxx")
if you want to output only true/false then drop the IF:
=INDEX(NOT(REGEXMATCH(A1:A6; "boy")))
or:
=FILTER(A1:A6; NOT(REGEXMATCH(A1:A6; "boy")))

Related

check value on 3 different cells and return true

=IFS(N15>=D15, M15="✓", O15>=2.5,"GREAT SUCCESS", TRUE,"EPIC FAIL")
I want to check multiple cells with if statement and only if all 3 are TRUE return 'success' but if even one of them FALSE I want to return 'fail'
IFS function params are cond1, result1, cond2, result2, ... Not stacking conditions and then the results.
From your explaination, you can just use normal IF, with AND like this:
=IF(AND(N15>=D15, M15="✓", O15>=2.5),"GREAT SUCCESS","EPIC FAIL")
If all 3 are correct, print "GREAT SUCCESS", else print "FAIL".
To apply to all row, instead of copy pasting or dragging the mouse to the entire table, you can use ARRAYFORMULA in the first row (don't do this if you're planning to export to xls/xlsx for Excel usage).
=ARRAYFORMULA(IF(AND($N$1:$N>=$D$1:$D, $M$1:$M="✓", $O$1:$O>=2.5),"GREAT SUCCESS","EPIC FAIL"))
Change the first row (N1, D1, M1) to your desired number, and maybe also adding the end row. (The formula above will apply to the end of sheet.)

Create a function that returns really nothing in Google Sheets

So I would like to create a function or something that returns absolutely nothing in a cell.
When I say nothing, I mean that if the cell before returns an array of value, it can write in this cell and doesn't returns #REF (Cannot expand results).
The idea is that I have a function sort() that get me a list of keys. Then I retrieve the values with a filter function like so :
=FILTER(B$2:B$7, A$2:A$7=D2)
But sometimes the keys (which are dates) can be duplicated, and that makes that the FILTER function with return 2 times 2 rows, creating a #REF error (cannot expand results).
If I create a condition :
=IF(D1<>D2, FILTER(/*...*/), "")
The second cell is empty but I still get the #REF error, because it's not really empty.
Is there a way to make that work ?
to create a function or something that returns absolutely nothing in a cell
try:
=IFERROR(0/0)
or:
=IF(;;)
but what you actually need is:
=UNIQUE(FILTER(B$2:B$7, A$2:A$7=D2))
or:
=INDEX(FILTER(B$2:B$7, A$2:A$7=D2), 1)
or:
=ARRAY_CONSTRAIN(FILTER(B$2:B$7, A$2:A$7=D2), 1, 1)

How do i remove rows based on comma-separated list of values in a Power BI parameter in Power Query?

I have a list of data with a title column (among many other columns) and I have a Power BI parameter that has, for example, a value of "a,b,c". What I want to do is loop through the parameter's values and remove any rows that begin with those characters.
For example:
Title
a
b
c
d
Should become
Title
d
This comma separated list could have one value or it could have twenty. I know that I can turn the parameter into a list by using
parameterList = Text.Split(<parameter-name>,",")
but then I am unsure how to continue to use that to filter on. For one value I would just use
#"Filtered Rows" = Table.SelectRows(#"Table", each Text.StartsWith([key], <value-to-filter-on>))
but that only allows one value.
EDIT: I may have worded my original question poorly. The comma separated values in the parameterList can be any number of characters (e.g.: a,abcd,foo,bar) and I want to see if the value in [key] starts with that string of characters.
Try using List.Contains to check whether the starting character is in the parameter list.
each List.Contains(parameterList, Text.Start([key], 1)
Edit: Since you've changed the requirement, try this:
Table.SelectRows(
#"Table",
(C) => not List.AnyTrue(
List.Transform(
parameterList,
each Text.StartsWith(C[key], _)
)
)
)
For each row, this transforms the parameterList into a list of true/false values by checking if the current key starts with each text string in the list. If any are true, then List.AnyTrue returns true and we choose not to select that row.
Since you want to filter out all the values from the parameter, you can use something like:
= Table.SelectRows(#"Changed Type", each List.Contains(Parameter1,Text.Start([Title],1))=false)
Another way to do this would be to create a custom column in the table, which has the first character of title:
= Table.AddColumn(#"Changed Type", "FirstChar", each Text.Start([Title],1))
and then use this field in the filter step:
= Table.SelectRows(#"Added Custom", each List.Contains(Parameter1,[FirstChar])=false)
I tested this with a small sample set and it seems to be running fine. You can test both and see if it helps with the performance. If you are still facing performance issues, it would probably be easier if you can share the pbix file.
This seems to work fairly well:
= List.Select(Source[Title], each Text.Contains(Parameter1,Text.Start(_,1))=false)
Replace Source with the name of your table and Parameter1 with the name of your Parameter.

Excluding one column from forEach

I'm using the following expression to return an md5 hash of a concatenation of all values in a row.
md5(forEach(row.columnNames,cn,if(isNull(cells[cn]),"",cells[cn].value)).join("|"))
This is to create an easy index for identifying duplicates (I do not wish to remove them at this stage). However, I've just realised that because one of the columns contains the unique index for the data set, I cannot hash every column as the inclusion of this column will obviously make every hash unique! (duh)
Is there a way to exclude a nominated column from the forEach loop? A sort of forEach except this...
Thanks
Assuming the column you want to exclude is the first one, you can subset row.columnNames like this:
md5(forEach(row.columnNames.slice(1),cn,if(isNull(cells[cn]),"",cells[cn].value)).join("|"))
If you prefer to exclude a column by its name (for example, "ID"), you should use filter() :
md5(forEach(filter(row.columnNames, v, v!="ID"),cn,if(isNull(cells[cn]),"",cells[cn].value)).join("|"))
Similarly, you can also use filter()to include/exclude column names based on conditions (here : exclude columns that contain a capital "C" in their name):
filter(row.columnNames, v, v.contains("C")==false)

Orbeon - how to get or set checkboxes

I have a simple questio: how to get/set checkbox from checkboxes in orbeon?
Something like this:
/myCheckboxes[value="itemVal"].isChecked()
That's right, the values are space-separated. To extract them, instead of contains() use this to check if value 42 is included:
tokenize(../myCheckboxGroup, '\s+') = '42'
This splits the value on spaces with the \s+ regexp and returns a string sequence.
By the way you don't need to write:
if (condition) true() else false()
You can always just write:
condition
i've made something like this:
to set: simply set value of checkbox group as a string compound by all items values i want to have checked separated by a space.
To check if checkbox is checked i`ve made something like this:
if(contains(../myCheckboxGroup, '2')) then true() else false()
but its not good solution for example because it's making that max items is 10 if i want to add values as a successive integers.

Resources