how can compare two cells in google sheets with multiple value in every cells and if even one value in two cells are same its show me match but if in two cells we do not have any same value show me not match.
for example I have these cells in my google sheets:
a1:[1,2,3,4]
b1:5,6,7
a2:[10,12,14,16]
b2:18,14,20
for these cell it should compare a1 and b1 and print not match in c1 then for a2 and b2 print match in c2 because a2 and b2 have a same value 14
you can try this arrayformula in Column C
=MAP(INDEX(REGEXREPLACE(A:A,"\[|\]","")),B:B,LAMBDA(ax,bx,IF(ax="",,IF(ISERROR(FILTER(SPLIT(ax,","),(MATCH(SPLIT(ax,","),SPLIT(bx,","),0)))),"FALSE","TRUE"))))
-
For not matching values-
=TEXTJOIN(",",1,LAMBDA(x,y,FILTER(x,NOT(ISNUMBER(XMATCH(x,y)))))(FLATTEN(SPLIT(SUBSTITUTE(SUBSTITUTE(A1,"[",""),"]",""),",")),FLATTEN(SPLIT(B1,","))))
For matching values-
=TEXTJOIN(",",1,LAMBDA(x,y,FILTER(x,ISNUMBER(XMATCH(x,y))))(FLATTEN(SPLIT(SUBSTITUTE(SUBSTITUTE(A2,"[",""),"]",""),",")),FLATTEN(SPLIT(B2,","))))
Edit: To show TRUE/FALSE try-
=INDEX(LAMBDA(x,y,OR(ISNUMBER(XMATCH(x,y))))(FLATTEN(SPLIT(SUBSTITUTE(SUBSTITUTE(A1,"[",""),"]",""),",")),FLATTEN(SPLIT(B1,","))))
Another approach, based on creating an intermediate 2D array of IFs for each pair of cells to be compared then summing the result; given the columns for comparison in A1:A & B1:B then placing this formula in C1 will spill as many results as required:
=arrayformula(iferror(map(A1:A,B1:B,lambda(a,b,if(sum(n(split(a,"[],")=flatten(split(b,"[],")))),"Match","No match")))))
I need to sum a range of cells across rows, but I need to be able to specify the amount with a variable.
For example.
If i write 5 in cell B1, I want to sum range A1:A5.
If i write 10 in cell B1, I want to sum range A1:A10.
If i write 20 in cell B1, I want to sum range A1:A20.
And so on.
Does anyone know a formula for this?
Kind regards.
I tried writing( in cell B1) =SUM(A1:A(1+B1)). This didn't work at all, instead a =NAME? appeared.
You may use INDIRECT to set a range by joining text, like this:
=SUM(INDIRECT("A1:A"&B1))
This formula will also work:
=SUM(BYROW(SEQUENCE(B1),LAMBDA(ROW,INDEX(A1:A,ROW))))
SEQUENCE() return an array of rows count up from 1 by default.
BYROW() can use an array as row reference and apply a LAMBDA() function to each row.
INDEX() return the CELL the matches a given INDEX of ROW and COL.
SUM sum up every value of a range (array).
also possibility:
=SUM(A1:INDEX(A:A; B1))
or:
=SUMPRODUCT(A1:INDEX(A:A; B1))
I need help formulating an arrayformula on how to return the last non-empty cell in a row across multiple rows.
The formula will be in column A in cell A2 and the output will look like this in column A:
The formula I have is only for 1 row. I need the formula (only 1 formula) to return the last non-empty cells of 1000+ rows.
This is the current formula I have but it's only for 1 row. I need to drag it down every time I add a new row:
=LOOKUP(1, ARRAYFORMULA(1/(B2:Z2<>"")),B2:Z2)
Is there an arrayformula that can do this across multiple rows without dragging down the formula?
any help would be appreciated. Thank you very much.
try:
=INDEX(REGEXREPLACE(TRIM(FLATTEN(QUERY(TRANSPOSE(
SUBSTITUTE(B2:Z, " ", CHAR(13))),,9^9))), ".* ", ))
I use this formula to print a yes in a cell if there are numbers >0 in the range $T4:$AE4 OR in the range $AG4:$AR4.
=IF(OR(COUNTIF($T4:$AE4,">0"),COUNTIF($AG4:$AR4,">0")),"yes","")
Then I drag the formula down (as I need this for a 1000 rows).
Is there a way to just have the formula for the first row and automatically populate the cells below if the rows below match the criteria?
I tried with an ARRAYFORMULA but it's not working..
=IF(OR(ARRAYFORMULA(COUNTIF($T4:$AE,">0")),ARRAYFORMULA(COUNTIF($AG4:$AR,">0"))),"yes","")
Try this formula:
=ArrayFormula(if(TRANSPOSE(MMULT(COLUMN(T4:AE)^0,TRANSPOSE(if(ISNUMBER(T4:AE),T4:AE,0))))+TRANSPOSE(MMULT(COLUMN(AG4:AR)^0,TRANSPOSE(if(ISNUMBER(AG4:AR),AG4:AR,0))))>0,"yes",""))
Explanation
mmult is used to make sums of $T4:$AE and $AG4:$AR
ISNUMBER is to convert all not numeric values into numbers in order to use only numbers in mmult function.
COLUMN(AG4:AR)^0 will give a column of ones (1,1,1,1,1) -- just what we need for mmult function.
Transpose is used because in [mmult] function:
the number of columns for matrix1 must equal the number of rows for
matrix2
so we need to transpose part of formula.
By the way, here's this formula but transformed to count matches of the word "word":
=ArrayFormula(if(TRANSPOSE(MMULT(COLUMN(T4:AE)^0,TRANSPOSE(--(T4:AE="word"))))+TRANSPOSE(MMULT(COLUMN(AG4:AR)^0,TRANSPOSE(--(T4:AE="word"))))>0,"yes",""))
As you can see, the principles of the formula can be used to match count logic.
My original array formula worked fine:
=ArrayFormula(if(E3:E="NULL"),"Unknown",E3:E))
With this formula whenever the sheet imported data that expanded the number of rows, the array formula would fill down.
But this new formula does not. The formula calculates for the cell in which it is typed, but does not automatically copy down:
=ArrayFormula(if(or(E3:E="NULL",ISBLANK(E3:E)),"Unknown",E3:E))
How can I edit my second formula to copy all the way down the length of the document?
In array formulas instead OR() use ADD() or the + operator
=ArrayFormula(If((E3:E="NULL")+ISBLANK(E3:E),"Unknown",E3:E))