How to input a discontinuous range into SUMIF in Google Sheets - google-sheets

I'm trying to do a SUMIF in Google Sheets, however since my input is a discontinuous range, it gives me an error. I am looking for a solution that does not require a Google Apps Script.
Works fine:
=SUMIF(A1:A9, "<>N/A")
Doesn't work:
=SUMIF(A1,A3,A7, "<>N/A")
Is there any method for doing a SUMIF with a non-continuous range as in the above non-working example?

try like this:
=SUMIF({A1; A3; A7}, "<>N/A")

Related

Extract Substrings using importxml in google sheets

Using IMPORTXML in google sheets. I want to extract part of the result into one cell.
=IMPORTXML(B1,"//div[#class='orca-rating SwtJyda color-yellow tbody-6']/span")
I got the result spread over several columns. B8:F8
The inspect element is like this. I only want the value "2". It is in cell B8.
I think this can be done using substring-after. But I could not get the correct result.
In your situation, how about the following samples?
=REGEXREPLACE(JOIN("",IMPORTXML(B1,"//div[#class='orca-rating SwtJyda color-yellow tbody-6']/span")),"[^0-9]","")
=REGEXEXTRACT(JOIN("",IMPORTXML(B1,"//div[#class='orca-rating SwtJyda color-yellow tbody-6']/span")),"\((.*)\)")
References:
REGEXREPLACE
REGEXEXTRACT
I use this formula. That works too.
=INDEX( IMPORTXML(B1,"//div[#class='orca-rating SwtJyda color-yellow tbody-6']/span"),3)
But tanaike's formula is very good.

How to use vlookup or index/match to return a formula instead of a value?

I'm trying to use vloookup or index/match in Google sheets to pull and plug in a query formula, rather than just its resulting value.
For example, I'm trying to use this vlookup formula:
=ArrayFormula(IFERROR(VLOOKUP(A2:A100,'SMS VLOOKUP'!A2:$B$500,2,0),""))
to plug in the formula:
=QUERY(courtdates,"SELECT D, C, BO, H WHERE BO = date '"&TEXT(TODAY()-1,"yyyy-mm-dd")&"'",0)
As I understand, you want to take formula from one place using vlookup and then use it in other place? Something like eval or evaluate() ?
The first part is possible using FORMULATEXT(cell) but you can't convert text of the formula into actual formula. Nothing like this using formulas.
The only way is using a script.

Vlookup in same range within different sheets on a different Google Spreadsheet | Google Sheets

I'm hoping to do a VLOOKUP in a different Google Sheet based on 2 criteria: sheet name and then the lookup value. My data looks something like this:
A1 B1 C1
Sheet_Name Lookup_Value Lookup_Value
Sheet_1 123456 =vlookup(B3,"Sheet_1!$A$1:$C$1000",2,false)
Sheet_1 987456 =vlookup(B4,"Sheet_1!$A$1:$C$1000",2,false)
Sheet_2 654123 =vlookup(B5,"Sheet_2!$A$1:$C$1000",2,false)
Sheet_3 959595 =vlookup(B6,"Sheet_3!$A$1:$C$1000",2,false)
Sheet_3 621346 =vlookup(B7,"Sheet_3!$A$1:$C$1000",2,false)
Is there a way I can choose the sheet in my vlookup equation based on the value in column A rather than going in manually and updating this?
Currently, I'm trying this, but it's not working:
=vlookup(B3,importrange("key_here",indirect(A3)&"!A1:C1000"),2,false)
Use INDIRECT:
=vlookup(B3,INDIRECT("'"&A3&"'!$A$1:$C$1000",2,false)
Figured it out: Google doesn't require the indirect function. So what works is:
=vlookup(B3,importrange("key_here",A3&"!A1:C1000"),2,false)

How to convert Excel formula to Google Sheets?

This code calculates a sum of string lengths in the range H1:V5 using G as a row index and C as a column index. It works perfectly in Excel:
{=SUMPRODUCT(LEN(INDEX(H1:V5,N(IF({1},ROW(G2:G5))),N(IF({1},C2:C5+1))))*ISNUMBER(G2:G5))}
But when I try it in Google Sheets it doesn't work although Google Sheets recognizes all commands. Is it possible to convert my formula to Google Sheets? Or maybe there is some workaround to get the same result there?
Open with Google Sheets returns incorrect result:
=ARRAY_CONSTRAIN(ARRAYFORMULA(SUMPRODUCT(LEN(INDEX(H1:V5,N(IF({1},ROW(G2:G5))),N(IF({1},C2:C5+1))))*ISNUMBER(G2:G5))), 1, 1)
Unfortunately the construct index...n(if({1}... is peculiar to Excel.
The vlookup function in Google sheets is very versatile and you can use that instead:
=SUMPRODUCT(len(vlookup(row(H1:K5),{row(H1:K5),H1:K5},C1:C5+2,false))*isnumber(G1:G5))

This array formula is not working

Hi following formula is working, but array formula is not working.
Working EQ:
=IF(V2:V=1,INDEX($E$2:$E,MATCH(T2&B2&"Delivered Time (Today)",$T$2:$T&$B$2:$B&$C$2:$C,0)),"")
I wonder, but this formula is not working:
=ARRAYFORMULA(IF(V2:V=1,INDEX($E$2:$E,MATCH(T2&B2&"Delivered Time (Today)",$T$2:$T&$B$2:$B&$C$2:$C,0)),""))
Can someone educate me to fix this?
Example details:
Example Sheet is here
Unfortunately not all Sheets functions work within an arrayformula, and INDEX and MATCH are two that do not
Instead, you can use VLOOKUP and construct an array to do the job of INDEX/MATCH:
=ArrayFormula(IF(V2:V=1,VLOOKUP(T2:T&B2:B&"Delivered Time (Today)",{T2:T&B2:B&C2:C,E2:E},2,0),))
You can it working in this copy of your example sheet:
https://docs.google.com/spreadsheets/d/1dFVNfPn0R9goQaLjRvZEwggRthbkEY3nC3aqC2joPcw/edit?usp=sharing

Resources