This array formula is not working - google-sheets

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

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 IMPORTXML and SEQUENCE together in Google Sheet

=ARRAYFORMULA("https://www.amazon.com/product-reviews/B08C1W5N87/ref=cm_cr_arp_d_viewopt_rvwer?ie=UTF8&reviewerType=avp_only_reviews&sortBy=recent&pageNumber="&SEQUENCE(5,1,1,1))
I use the code above to have the links that I would like to scrap the data. There are 5 links.
=IMPORTXML(A6,"/html/body/div[1]/div[3]/div/div[1]/div/div[1]/div[5]/div[3]/div/div[*]/div/div/div[2]/a[1]/i")
I also use the formula above to scrap the data I want from the link. A6 refers to the first link the first formula creates.
What I would like to do is, if possible, I want to scrap the data from the 5 links and list them in a column.
=IMPORTXML(ARRAYFORMULA("https://www.amazon.com/product-reviews/B08C1W5N87/ref=cm_cr_arp_d_viewopt_rvwer?ie=UTF8&reviewerType=avp_only_reviews&sortBy=recent&pageNumber="&SEQUENCE(5,1,1,1)),"/html/body/div[1]/div[3]/div/div[1]/div/div[1]/div[5]/div[3]/div/div[*]/div/div/div[2]/a[1]/i")
The formula above did not work.
=ARRAYFORMULA(IMPORTXML("https://www.amazon.com/product-reviews/B08C1W5N87/ref=cm_cr_arp_d_viewopt_rvwer?ie=UTF8&reviewerType=avp_only_reviews&sortBy=recent&pageNumber="&SEQUENCE(5,1,1,1),"/html/body/div[1]/div[3]/div/div[1]/div/div[1]/div[5]/div[3]/div/div[*]/div/div/div[2]/a[1]/i"))
The formula above did not work as well. It always scraps the first link's data only.
Thank you for your help in advance.
keep in mind that IMPORTXML itself is a "type of arrayformula" so it is not supported under ARRAYFORMULA
in your case try to hardcode 5 IMPORTRANGE formulae into array {} like:
={IMPORTRANGE();
IMPORTRANGE();
IMPORTRANGE();
etc}
update
with new LAMBDA function its possible to do it in one go:
=INDEX(TRIM(FLATTEN(SPLIT(FLATTEN(BYCOL(
"https://www.amazon.com/product-reviews/B08C1W5N87/ref=cm_cr_arp_d_viewopt_rvwer?ie=UTF8&reviewerType=avp_only_reviews&sortBy=recent&pageNumber="&
SEQUENCE(1,5,1,1), LAMBDA(x, QUERY(IMPORTXML(x,
"/html/body/div[1]/div[3]/div/div[1]/div/div[1]/div[5]/div[3]/div/div[*]/div/div/div[2]/a[1]/i")&"×",,9^9)))), "×"))))

Adapt a formula to ArrayFormula

Im very new to Google Sheets formulas.
Im trying to convert this formula:
=INDEX(PRX_ARM,MATCH(ELECTRICITE!E97,OFFSET(PRX_ARM_C1,0,MATCH(ELECTRICITE!G97,PRX_ARM_L1
,1)-1),1), MATCH(ELECTRICITE!G97&"1",PRX_ARM_L1,1))+
ELECTRICITE!H97*INDEX(PRX_REL,2,2)+
ELECTRICITE!I97*INDEX(PRX_REL,3,2)+
ELECTRICITE!J97*INDEX(PRX_BP_VOY,2,2)+
ELECTRICITE!K97*INDEX(PRX_BP_VOY,3,2)+
ELECTRICITE!L97*INDEX(PRX_BP_VOY,4,2)+
ELECTRICITE!M97*INDEX(PRX_BP_VOY,5,2)
So naturally, i converted every single cell reference to the range ArrayFormula must be applied to :
=ArrayFormula(INDEX(PRX_ARM,MATCH(ELECTRICITE!E90:E5030,OFFSET(PRX_ARM_C1,0,MATCH(ELECTRICITE!G90:G5030,PRX_ARM_L1,1)-1),1),
MATCH(ELECTRICITE!G90&"1",PRX_ARM_L1,1))+
ELECTRICITE!H90:H5030*INDEX(PRX_REL,2,2)+
ELECTRICITE!I90:I5030*INDEX(PRX_REL,3,2)+
ELECTRICITE!J90:J5030*INDEX(PRX_BP_VOY,2,2)+
ELECTRICITE!K90:K5030*INDEX(PRX_BP_VOY,3,2)+
ELECTRICITE!L90:L5030*INDEX(PRX_BP_VOY,4,2)+
ELECTRICITE!M90:M5030*INDEX(PRX_BP_VOY,5,2))
But it does not work.
Do you know what im doing wrong?
Thanks in advance.
Yu can't use index with arrayformula, use instead vlookup

Using multiple function for COUNTIFS in google sheets

=COUNTIFS((Tab1!C2:Tab1!C250),"*sam*") & ((Tab1!B2:Tab1!B250), ">1-Nov-2020")
In the above formula, I'm trying to get the count of 'person names whose name is sam and the value which is past 1-Nov-2020.
While trying to fetch the count using the above formula, it is showing Formula parse error.
Please analyze and tell where might I went wrong.
You need to correct your syntax to:
=COUNTIFS('Tab1'!C2:C9,"sam", 'Tab1'!B2:B9,">1-Nov-2020")
Please read more on how the COUNTIFS function work.
EDIT (following OP's comment)
The correct syntax would be
COUNTIFS(criteria_range1, criterion1, [criteria_range2, …], [criterion2, …]) meaning:
=COUNTIFS('Tab1'!C2:C9,"sam", 'Tab1'!B2:B9,">1-Nov-2020", 'Tab1'!B2:B9,">=1-11-2020")
BUT
Since you refer to dates 1-Nov-2020 is the same as 1-11-2020.
So you only need
=COUNTIFS('Tab1'!C2:C9,"sam", 'Tab1'!B2:B9,">=1-11-2020")
OR
=COUNTIFS('Tab1'!C2:C9,"sam", 'Tab1'!B2:B9,">=1-Nov-2020")

Google Spreadsheet, use array formula with filter betwen date

Hy everyone,
I try a simple trick, Use an array formula with a countblank with a filter between date. Without array, its work great, with an array, it goes crazy. why?
I use a spreadsheet to follow the present or absent off people by month. (exemple sheet)
I try to like this by line and its work fine:
=COUNTBLANK(FILTER(D9:AU9,D8:AU8>=B4,D8:AU8<=B5))
When i try to apply this to every line, its goes crazy :
=ARRAYFORMULA(IF(A8:A19<>"",COUNTBLANK(FILTER(D8:AU,D8:AU8>=B4,D8:AU8<=B5)),""))
Where is my mistake?
In C8 try this formula
={""; Arrayformula( if(len(A9:A), countif(if((D9:AU="")*(month($D$8:$8)=month($B$3)), row(A9:A)), row(A9:A)),))}
and see if that works?

Resources