Count matches between two columns on Google Docs - google-sheets

I have two columns that I want to test if any of their values matches and count how much of them. For example:
1 2
2 5
3 1
4 7
Should return two, since 1 and 2 are in both columns.
I've found that in excel I could do =SUMPRODUCT(A1:A4=B1:B4), but I can't find the same in Google Spreadsheet. I tried =ARRAYFORMULA(SUMPRODUCT(A1:A4=B1:B4)), but it didn't work.
Thanks for the help!

I think its strange to answer your own question, but since I found the solution..
I archieved it doing =ARRAYFORMULA(SUM(COUNTIF(A1:A4=B1:B4)))

Related

QUERY to return numbers from range in rows of 5

My data is a sorted list of numbers with multiple duplicates. I'd like to use QUERY to return them in groups of 5 -- so that if, for example, the number 7 had 8 instances, there would be 8 rows of the number 7, followed by 2 blank rows (8 + 2 = 10, a multiple of 5).
Please reference the tab named QUERY grouped by 5s in the following sheet:
https://docs.google.com/spreadsheets/d/1L-XuT-H1pzl36OGGw5pPPLpkzX3kDrOxL2V7YIUr3hI/edit?usp=sharing
I've tried many different methods to no avail. I'd like to avoid Apps Script, if at all possible. Any help would be greatly appreciated as I've been racking my head against the wall for a while now.
added formula to your sheet here. please test it out.
=LAMBDA(ax,INDEX(TRIM(SPLIT(ax,"🐠"))))(TRANSPOSE(SPLIT(TEXTJOIN("",1,MAP(UNIQUE(FILTER(INDEX(A2:A&"🐠"&B2:B&"🐠"&C2:C&"|"),A2:A<>"")),BYROW(UNIQUE(FILTER(A2:C,A2:A<>"")),LAMBDA(ax,IF(ax="",,COUNTIF(INDEX(A:A&B:B&C:C),JOIN("",ax))))),LAMBDA(ax,bx,IF(ax="",,{REPT(ax,bx)&REPT(" "&"🐠"&"|",CEILING(bx,10)-bx)})))),"|")))
-

Splitting Cell into Multiple row using array

I am trying to split the range of data like this :-
At first I was using this :-
=ARRAYFORMULA(IF(ROW($B$2:$B)>=(SUM($A$2:$A)+ROW()),"",IFERROR(SPLIT(LOOKUP(ROW($B$2:$B)-ROW(),IF(ROW($B$2:$B)>=(SUM($A$2:$A)+ROW()),"",SUMIF(ROW($A$2:$A),"<"&ROW($A$2:$A),$A$2:$A)),A2:A),"🙂"),"")))
But this didn't worked, I got this from another stack answer, I know this is not right :(, I can't reach anywhere with this
This is the sheet URL :- https://docs.google.com/spreadsheets/d/1oB1i0IAGoCVN0ynKBXDQcmEd3c_mpOdmWVFo7Gz-vyk/edit#gid=0
Thanks
Formula for you
=TRANSPOSE(SPLIT(JOIN(CHAR(10),A2:A7),CHAR(10),1,0))
Function References
JOIN
SPLIT
REDUCE the array by SPLITting by CHAR(10):
data
Intended Result
1
1
123
1
2
3
=REDUCE("Intended Result",A2:A5,LAMBDA(a,c,{a;IFERROR(TRANSPOSE(SPLIT(c,CHAR(10))))}))

Check a column of strings on another column of substrings

I want to check a column of strings on another column of substrings to see the strings contain any of the substrings.
I am currently attempting =SEARCH(lower('Sheet2'!$A$1:$A$100),lower(B1)) and would like a True/False response.
Thanks in advance.
An example of Sheet2 would be:
A
1 Hello
2 Hi
3 I said she
an example of Sheet1 with the expected result in column C would be:
A B C
1 23 There are many FALSE
2 45 I said he is slow FALSE
3 3 I said she is bad TRUE
4 78 he yelled hello TRUE
Any help is appreciated
EDIT: link to example - https://docs.google.com/spreadsheets/d/1c2pskSYsGs12Yjbn-5gORQ22mDSaC9cSnp1nWeULlf4/edit?usp=sharing
In Sheet1!C1:
=ArrayFormula(IF(B:B="",,REGEXMATCH(LOWER(B:B),JOIN("|","\b"&FILTER(LOWER(Sheet2!A:A),Sheet2!A:A<>"")&"\b"))))
You haven't shared a link to a spreadsheet, so this is untested on any actual data. Your locale is also unknown, which may required modifications as well. So if this formula doesn't work as provided, share a link to your sample spreadsheet.

Dynamic Formula to give result Cardinal numbers

I have been trying to count Dynamically the number of rows based on Col"B" as available in attached sheet.
Dynamic formula will give Countdown from 1 to onward based on col"B" values, such as
1
2
3
4
5
6
and so on
Any help will be appreciated.
or the logic way:
=INDEX(IF(B1:B="";;ROW(B1:B)))
or from row 2:
=INDEX(IF(B2:B="";;ROW(B2:B)-1))
or like:
=INDEX(ROW(INDIRECT("B1:B"&COUNTA(B1:B))))
Did this do the trick:
=SEQUENCE(COUNTA(B1:B))

Sum entries per date when multiple entries of date exist

I have 1 column of dates and 1 column of 'wins' recording 1 and -1 as wins and losses. I need a quick way to tally the score across each date (so I can graph the win-rates). Eg. 5th May 7 wins, 6th may -2 wins, etc. I have multiple entries for each date and several days to work through so I can't do it manually. What would be the simplest approach/formula to solve this issue?
I'm working in Google Sheets. If someone has a simple workaround in Excel too, the solution is welcome.
Try:
=SUMPRODUCT(($A$2:$A$12=$E$1)*($B$2:$B$12)) in cell E6
Data structure:
=QUERY(A1:B, "select A,sum(B)
where A is not null
group by A
label sum(B)''")

Resources