Count How Many In Column A are also in Column B - regex

I'm trying to create a formula to count how many cells in a first column are also in a second column. It's 2 lists from the same source of unique id's, fitting 2 different criteria, and I want to count how many fit both criteria. Any help is appreciated.

try like this:
=ARRAYFORMULA(SUM(N(REGEXMATCH(B1:B, TEXTJOIN("|", 1, A1:A)))))

Related

Power BI function that checks if multiple specified values (numbers) exist in a column

Is there a function in Power BI that can check whether a list of specified values (numbers) exists in a column?
For example, in the image below, I have a column with some values and another one with 0 and 1s. You can see that some values are marked with 1 and some with 0. In order to do this, I used IF function, but this is just too cumbersome.
I am looking for a formula that can check if the values from a list like {XXXX, XXXX, XXXX, etc} exist in a column and that can easily be edited when I need to add other values.
Thank you and have a good day!
Best,
Denis
You can do that by adding a custom column for example. If we assume your table is named Table and first column is named Value, then add a custom column like this:
Where the list contains all the values of interest. This will give you a boolean column Flag:
If you want an integer column with 0 and 1 values, then change the column to something like this:
= if (List.Contains({"5006", "4905"}, [Value])) then 1 else 0

In Google Sheets how to reference infinite columns in all rows?

The issue of how to reference infinite rows is already answered, but how about referencing infinite columns?
For example Sheet1 has data with an indeterminate number of rows and columns, Sheet2 I have this formula
=arrayformula(if(Sheet1!A:Z="","blank","not blank"))
It goes infinitely down... but what if I want Sheet1!A:InfiniteColumns
This is the best I could come up with
=arrayformula(if(indirect("sheet1!R1C1:"&"R"&rows(Sheet1!A:A)&"C"&COLUMNS(Sheet1!1:1),false)="","blank","not blank"))
So my question is, is there a shorter and simpler way to accomplish this?
try:
=ARRAYFORMULA(IF(INDIRECT("Sheet1!A1:"&ROWS(Sheet1!A:A))="", "blank", "not blank"))
May be this sample will get all columns from row 1 to row 1:
=arrayformula(if(Sheet1!A1:1="","blank","not blank"))
So for infinite columns we can take all columns from row 1 to last row:
=arrayformula(if({indirect("MainSheet!1:" & rows(MainSheet!A:A))}="","blank","not blank"))

Auto-Populating to create 1 list in 1 column based on data from two different columns (Google sheets)

Having some trouble with a very simple problem. I want to create 1 list in a column based on data from two different columns, I only want each item to appear once in the list column.
So to create the list based on data from one column, I used this formula but I don't know how to do it from 2 (and the number of occurrences/count isn't needed).
=ArrayFormula(QUERY(J2:J&{"",""},"select Col1, count(Col2) where Col1 != '' group by Col1 label count(Col2) 'Number of occurrences'",-1))
https://docs.google.com/spreadsheets/d/1loPw3eUALLKx3NzXrxhDszqD2_B7G3cyH1EhnYg4tFg/edit?ts=5cf63f94#gid=0
Maybe something like:
=sort(UNIQUE({A1:A10;B1:B12}))
If your locale uses , as separator, the lists are in A1:A10 and B1:B12 and you want the result sorted.

Sum values in one column of all rows which match one or more of multiple criteria

I have some table data in which I'd like to sum all the values in a specific column of all rows where column A contains string A and/or column B contains string B. How can I achieve this?
This works for one criterium:
=SUM(FILTER(G:G,REGEXMATCH(F:F,"stringA")))
I tried this, but it didn't work:
=SUM(FILTER(G:G,OR(ISTEXT(REGEXMATCH(F:F,"stringA")),ISTEXT(REGEXMATCH(C:C,"stringB")))))
Please try:
=SUM(FILTER(G:G,REGEXMATCH(F:F,"stringA")+REGEXMATCH(C:C,"stringB")))
+ works for or logic. ISTEXT is not needed because REGEXMATCH gives true or false.
OR does not work because filter is an arrayformula, use + in array formulas.
=SUM(FILTER(G:G,REGEXMATCH(F:F&C:C,"stringA|stringB")))
OR is denoted by |
EDIT Added &C:C to denote different Columns

Join only some cells from a column - Openrefine

I've a dataset like this:
I need to join only the last three columns (the authors) and the join function is not helping me. I don't have always 3 authors: they can be 2, it can be 1.
Is there a way to join only the cells which have empty cells in the near column?
A solution a bit simpler is to use slice() to select all values on each record except the first one :
row.record.cells['Column name'].value.slice(1).join("|")
Well, I used a workaround:
first I add another column with row.record.cells.NameColumn.value.join("|")
then in the new column I eliminated the book title doing value.replace(/(^[^\|]+)\|(.+)$/, "$2")