Please help me with the Formula & ArrayFormula: - google-sheets

I want to return TRUE for blank cells until last value (check out the Required column)
I tried this formula: =AND($A2="" ,$A3:$A <> "") but it didn't work.
Question 1: How can I make 2nd argument i.e. $A3:$A <> "" return true if any one cell in the range $A3:$A is Not Null? Final Formula?
(I know my formula is wrong because it doesn't check every cell in the range mentioned if it is NULL or not, how can I make it check every cell?)
Question 2: ArrayFormula for the corresponding Formula.
(Please suggest if there's any better way to get the Formula & ArrayFromula along with the solution of the method I tried)
Here is the sheet link: https://docs.google.com/spreadsheets/d/1VF38MNcP1e4ieZY47QQq1zOwGYWAmuJ2k9A0WkGYeX0/edit?usp=sharing
EDIT:
I got the Formula: =IFNA(MATCH(FALSE,ArrayFormula(isblank(A2:A)),0),0)>1
For ArrayFormula I just tried wrapping it around but it didn't work: =ARRAYFORMULA(IFNA(MATCH(FALSE,ArrayFormula(isblank(A2:A)),0),0)>1)
I just need the ArrayFormula of this Formula & please tell me what's wrong in my ArrayFormula?
Thank you!

Try below formula.
=ArrayFormula(A2:A10="")
For full column
=ArrayFormula(A2:A="")
Edit: Then use below formula.
=ArrayFormula(INDEX(A:A,2):INDEX(A:A,MAX(IF(A:A<>"",ROW(A:A),0)))="")

try:
=INDEX(INDIRECT("A2:A"&MAX(IF(A2:A="",,ROW(A2:A))))="")
or:
=INDEX(INDIRECT("A2:A"&MAX((A2:A<>"")*ROW(A2:A)))="")

I suggest this simple formula:
=ArrayFormula(NOT(A2:A))
Since any value equates to TRUE and null equates to FALSE, wrapping the range in NOT will return the opposite.
ADDENDUM:
Given additional information from poster:
=ArrayFormula(IF((A2:A="")*(ROW(A2:A)<VLOOKUP(TRUE,SORT({A2:A<>"",ROW(A2:A)},2,0),2,FALSE)),TRUE,FALSE))

Related

How to use COUNTIFS with ARRAYFORMULA

I have this formula that checks for the 2nd(onwards) instance of duplicate using 2 columns. I want it to be automatically applied to new rows but can't seem to figure out how to use ARRAYFORMULA for COUNTIFS. Can anybody please help me convert this formula =COUNTIFS($K$2:$K2, $K2, $T$2:$T2, $T2)>1 to an arrayformula or something similar? Thanks!
MAP() function may be a good solution. Try-
=MAP($K$2:INDEX($K$2:$K,COUNTA($K$2:$K)),$T$2:INDEX($T$2:$T,COUNTA($K$2:$K)),LAMBDA(x,y,COUNTIFS($K$2:$K,x,$T$2:$T,y)>1))
K2:INDEX(K2:K,COUNTA(K2:K)) will return a array of range from K2 to next non empty cell of K column.
Same T2:INDEX(T2:T,COUNTA(K2:K)) will return a array of range from T column still base on K column last non empty cell.
Edit: As per comment, try below formula-
=INDEX(MAP(A2:INDEX(A2:A,COUNTA(A2:A)),C2:INDEX(C2:C,COUNTA(A2:A)),LAMBDA(x,y,COUNTIFS(A2:A,x,C2:C,y,ROW(A2:A),"<="&ROW(x))>1)))
Change ranges for your sheet.

Array formula in googlesheets being errored out by new row

I am using the array formula below to apply the same formula to new rows when they are added. However, when new rows are added, it messes up the formula (I think it is autocorrecting, or something). I went to Tools and turned off all autocomplete functions. Does anyone know what could be happening?
The formula I am using:
=ARRAYFORMULA(IF(LEN(C2:C),IF(C2:C<TODAY(),1,0),))
try to freeze it:
=ARRAYFORMULA(IF(LEN(INDIRECT("C2:C")),IF(INDIRECT("C2:C")<TODAY(),1,0),))
or if this is a form sheet use this formula in row 1:
={""; ARRAYFORMULA(IF(LEN(C2:C),IF(C2:C<TODAY(),1,0),))}
You're missing a "false" case in the outer IF statement.
=ARRAYFORMULA(IF(LEN(C2:C),IF(C2:C<TODAY(),1,0),**missing**))
Also I don't think you can use a column for the len() function. I'm not sure what the context of this formula is but I suggest trying to remove the ARRAYFORMULA() like so:
IF(LEN(C1),IF(C1<TODAY(),1,0),**some false case**)

Using query in google sheet to call certain rows

Hi everyone,
I want to get all the rows where A=1, A=2. The query is very simple but I'm not sure why there is no output. I guess is the problem of the format for column A but I'm not sure what should I change in my formula so that the formula can work. Appreciate any help or advice!
A can't be both: 2 and 1. Instead try
=query(A3:C, "Where A = 2 or A = 1", 0)
It should have been OR not AND - it's impossible for any row in a particular column to have two values simultaneously:
=query(A3:C,"select * where A=1 or A=2",0)
QUERY() is good choice. You can also use FILTER() function like-
=FILTER(A3:C,A3:A>=1,A3:A<=2)

If & match function together in spreadsheets

I wrote this formula in the spreadsheet: =if(match(AR$2,$A5:$E5,0),AR$2,"")
If there is no match, it's supposed to leave the cell blank, instead it gives #N/A. but if there is a match, it gives the value. Can anybody show me how to correct this? thanks.
You could use iferror
try something like:
=iferror(if(match(AR$2,$A5:$E5,0),AR$2),"")

Google Sheets right() in Sum in Arrayformula returning false values

I've a column of sample data where each cell is either blank or (3 alpha chars, 1 white space, 1 digit). For example:
I need to check if the cell begins with "GTR" or "DBT", then return the number, and sum the return of the column. I'm using the formula below:
=ARRAYFORMULA(sum(IF(OR(left(A1:A10,3)="GTR",left(A1:A10,3)="DBT"),VALUE(right(A1:A10,1)),0)))
The problem is that instead of returning 20, it returns 52.
In fact it appears to return the last char of any cell in the range. (eg. if "A5" has a value of 'someText' the formula returns an error because value() can't parse 't' into a number.
I'd like to know if anyone can tell me how to solve this problem, or if there's something wrong with my formula?
Here's an example of this problem in a Google Sheet:
https://docs.google.com/spreadsheets/d/1XNVUWhI43UW2ABrja8rmplmxhhkSu-je45F-9F_3GQM/edit#gid=0
Thanks,
Onji
The ArrayFormula plus OR will evaluate to TRUE if any of the cells in the range is in the codition, to overcome this remove the OR, and add an IF for every condition, as such:
=ARRAYFORMULA(sum(IF(left(A1:A10;3)="GTR";VALUE(right(A1:A10;1));0);IF(left(A1:A10;3)="DBT";VALUE(right(A1:A10;1));0)))
In addition to the solution of Kriggs, this formula should also work:
=ArrayFormula(sum(if(regexmatch(B3:B12, "GTR|DBT")=TRUE, right(B3:B12)+0,)))

Resources