If & match function together in spreadsheets - google-sheets

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),"")

Related

Conditional formatting, if A2<B2 and D2<E2 on Sheet1, then cell is green on Sheet2

I'm trying to do as titled.
Product on Sheet2 will only be coloured green if both A2<B2 and D2<E2 on Sheet1.
If one of the criteria isn't fulfilled, the product will not be green.
Here's the example sheet.
I tried this formula, but either there's no effect, or I get an invalid code error.
=AND(INDIRECT("'Source Data'!A2<'Source Data'!B2","'Source Data'!D2<'Source Data'!E2")
Is there something wrong with the formula? Thanks in advance.
You asked:
Is there something wrong with the formula?
Yes. You are using INDIRECT the wrong way. Please read more about INDIRECT
For your given data you can use
=AND(INDIRECT("'Source Data'!A"&ROW()-2)<INDIRECT("'Source Data'!B"&ROW()-2),
INDIRECT("'Source Data'!D"&ROW()-2)<INDIRECT("'Source Data'!E"&ROW()-2))

Please help me with the Formula & ArrayFormula:

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))

Search for string with VLOOKUP in Google Sheets

Trying to find a particular string in a google sheet column (column A) and return the value of the cell directly to the right (column B). If tried the following, but keep getting a Formula parse error. Please advise:
=VLOOKUP(“Assessment Guide - AWG”, A16:B120,2,FALSE)
That formula looks right to me, but if you could take a screenshot of how you wrote the formula that would be helpful. Usually formula parsing issues happen when you use a semicolon instead of a comma or have an extra parenthesis or a quote in the wrong place.

ARRAYFORMULA VLOOKUP with ISBLANK in google sheets

I am trying to get a VLOOKUP to work on an entire column (minus the header), but I want blank entries if the column I am searching for is empty. I tried both these formulas, but to no avail (I still get the N/A in empty cells):
=ARRAYFORMULA(IF(ISBLANK(VLOOKUP(O2:O,Sheet1!B:C,2,FALSE)),"",VLOOKUP(O2:O,Sheet1!B:C,2,FALSE)))
=ARRAYFORMULA(IF(O2:O<>"",VLOOKUP(O2:O,Sheet1!B:C,2,FALSE)),"")
This is a slightly more complicated way than what I got working in another part of my sheet, which is the same without the VLOOKUP:
=ARRAYFORMULA(IF(ISBLANK(J2:J),"",J2:J))
Any ideas what am I doing wrong?
If you want to leave a blank instead of #N/A in a cell, you can use =IFERROR.
Like this:
=IFERROR(Your_formula, "value if the formula returns an error")
Since you are using ARRAYFORMULA, the iferror must be inside it
=ARRAYFORMULA(IFERROR(VLOOKUP(O2:O,Sheet1!B:C,2,FALSE),""))

Find Unique in google sheets - first n characters

I have a google sheet with a column (A) of urls.
Xttps://tXco/008wnbebbw
Xttps://tXco/00lR1FNKBo
Xttps://tXco/00lR1Fw9cO
Xttps://tXco/00UwZwgh2h
Xttps://tXco/00UwZwxSqR
Xttps://tXco/00UwZwxSqR
Xttps://tXco/044TcIFl72
In column B I need to find all unique urls up to the 18th character. For instance column B should show:
Xttps://tXco/008wnbebbw
Xttps://tXco/00lR1FNKBo
Xttps://tXco/00UwZwgh2h
Xttps://tXco/044TcIFl72
I have this formula which I was trying to adapt for it (not sure if it helps at all). I was trying to adapt this to use with =UNIQUE( ?
=SUMPRODUCT(--(LEFT($A$1:$A$15,18)=LEFT(A1,18)))>1
If it helps to take a look at the sheet, here it is: https://docs.google.com/spreadsheets/d/1tG7TpHNvNY86PRiePsKyKfxnuEZah6T7ZDL7dXOIcEA/edit?usp=sharing
Thanks in advance!
You may try this formula:
=ArrayFormula(vlookup(
UNIQUE(FILTER(LEFT(A2:A,17),A2:A<>"")),
FILTER({LEFT(A2:A,17),A2:A},A2:A<>""),
2,0))
How it works
it will first find unique left N chars:
UNIQUE(FILTER(LEFT(A2:A,17),A2:A<>"")
then get left N chars and original strings:
FILTER({LEFT(A2:A,17),A2:A},A2:A<>"")
and then use vlookup to get top first entry for uniques.
Try this instead without the extra column. Put it in B1:
=unique(arrayformula(if(left(A1:A,18)=left(A1:A,18),A1:A,"")))
Try this: =unique(arrayformula(left(A1:A,18)))

Resources