Arrayformula to compare two columns and skip blank cells - google-sheets

I have two columns on two different sheets with a long list of values; I'm trying to compare these two columns to check if an entry in the first one exists in the second one. In the first column there are also blank cells.
I tried different formulas but all of them is returning a value for blank cells, instead of a blank cell.
These are the formulas I tried:
=arrayformula(iferror(if(match(A1:A,AnotherSheet!A1:A,0),"yes"),"no"))
=query(arrayformula(iferror(if(match(A1:A,AnotherSheet!A1:A,0),"yes"),"no")), "Select * where Col1<>''")
=query(arrayformula(iferror(if(match(A1:A,AnotherSheet!A1:A,0),"yes"),"no")), "Select * where Col1 is not empty")
All of them is returning "no" for blank cells in the first column, I would like to have a blank cell instead. Thank you

=ARRAYFORMULA(IF(LEN(A1:A), IFERROR(IF(MATCH(A1:A, AnotherSheet!A1:A, 0), "yes"), "no"), ))

Related

Array formula and MAX value of 2 cells

I'm trying to get max value between 2 cells (one is same column, previous row, another is in the same row, but different column) with an array formula. I use array, because I need it to be updated automatically row after row with each new entry in column A without adding formula to new cells each time.
Just MAX formula is following:
I3512=MAX(I3511,C3512)
This array formula gives same result in each following cell
I3513 = ARRAYFORMULA(IF(ISBLANK(A3513:A),,MAX(I3512,C3513)))
This formula also, gives me the same result in each row, as counting the max from C column.
I3513 = ARRAYFORMULA(IF(ISBLANK(A3513:A),,MAX(I3512:I,C3513:C)))
Also I tried this version, but it fails in the middle, showing wrong values.
I3513 = ARRAYFORMULA(IF(ISBLANK(A3513:A),,if(I3512:I<C3513:C,C3513:C, I3512:I)))
How to apply MAX formula to all rows in column I after row 3513, finding between previous cell and another column same row.
Suggested formula result
if just two columns use IF in row 3513:
=ARRAYFORMULA(IF(A3513:A="";; IF({I3512:I; ""}>C3513:C; {I3512:I; ""}; C3513:C)))
Use OFFSET
For example:
C3 =
{
"MAX PNL";
"N/A";
ArrayFormula(
IF(
OFFSET(A3:A1000, -1, 0) > B3:B1000,
OFFSET(A3:A1000, -1, 0),
B3:B1000
)
)
}
Bear in mind with this technique you can't use ranges like A3:A as this will give you an error:
This is because since it references two rows, it gets confused and always requires more rows.

Apply VlLOOKUP till last non-empty row in google sheets

I have an automatically expanding google in which I am applying a Vlookup formula to extract values from another sheet matching the values from the main sheet.
This is the Vlookup formula-
=VLOOKUP(A2, IMPORTRANGE("1MNRMKGkC-c0COugUWpXOe5OxJXfmdXGboxAPhf5SaLA", "Sheet1!B3:E420"),4,0)
I want the formula to be auto applied to the new entries which get auto added in the main sheet. I used this formula I found on a website to apply this formula to the whole column also taking care of any empty cells in between.
=ArrayFormula(IF(ISBLANK(A2:A), "", VLOOKUP(A2:A, IMPORTRANGE("1MNRMKGkC-c0COugUWpXOe5OxJXfmdXGboxAPhf5SaLA", "Sheet1!B3:E420"),4,0)))
My problem is that after using this formula when a new entry is auto added to column A in the sheet, it gets added to 1001th row instead of the next non-empty row, because this formula is being applied to whole column.
Is there some way to apply the Vlookup to just be applied till last non-empty row, so that my next automatic entry gets added in the next empty row? Or any other alternative solution?
Thanks for the help!
try:
=ARRAYFORMULA(QUERY(IF(ISBLANK(A2:A),,VLOOKUP(A2:A,
IMPORTRANGE("1MNRMKGkC-c0COugUWpXOe5OxJXfmdXGboxAPhf5SaLA", "Sheet1!B3:E420"), 4, 0)),
"where Col1 is not null", 0))
Since we don't have sheet for reference assuming new data is added to new column.
Try this fromula =ARRAYFORMULA(If(A2:A="","",VLOOKUP(A2:A, IMPORTRANGE("1MNRMKGkC-c0COugUWpXOe5OxJXfmdXGboxAPhf5SaLA", "Sheet1!B3:E420"),4,0)))
This will do vlookup once there is new data in Column 'A'

Get the 10 lastest not blank value cell in one column

This formula looks for the last cell that is not blank in a specific column. I'd like to get the values from the last 10 nonempty cells in the column.
=FILTER(H:H , ROW(H:H) =MAX( FILTER( ROW(H:H) , NOT(ISBLANK(H:H)))))
At the moment I can get the value of the last non-empty cell, I would like to know what I need to adjust in order to get the values of the last 10 non-empty cells of a specific column.
use query instead:
=QUERY(A:A, "where A is not null offset "&COUNTA(A:A)-10, 0)

Sumifs outputting blank cells as zero

I am trying to use a sumifs statement to sum a column over 2 criteria. The column I am summing over has blank cells. The sumifs statement returns a zero for these instances, and I want it to return blank. Some of the sums are actually equal to zero so I need to differentiate between the zeros and the blanks.
You could try using if(isblank(cell), "", sumif())
if the one of the cells is blank, it returns a blank
else, it will use the sumif formula

How do I reference one cell created in ARRAYFORMULA from another?

Let's say I'm using ARRAYFORMULA to generate values (whitespace is for readability):
=ARRAYFORMULA({
Sheet1!A1:C,
Sheet1!A1:A * Sheet1:B1:B,
Sheet1!A1:A * Sheet1:B1:B + Sheet1!C1:C
})
The first 3 cells are directly from Sheet1.
The 4th cell is a formula using the values from the first 2 cells.
The 5th cell is a formula using the value from that 4th cell, and then adding the 3rd cell.
Instead of needing to re-calculate the 4th cell in the 5th cell, is there a way to reference the result of the 4th cell in the 5th cell?
No, there is no way to reference a column of virtual array {} within the same array. Two workarounds are:
Create the column A*B+C using a second array formula, which references the output of the first
or,
Wrap the output of arrayformula in a query which can reference the columns as Col1, Col2, ...
Example:
=query(arrayformula({A1:C, A1:A*B1:B}), "select Col1, Col2, Col3, Col4, Col4+Col3 label Col4+Col3 ''", 0)

Resources