=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)))), "×"))))
Related
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.
Hi everyone,
I'm trying to count the number of "Yes" appeared in each row. I want to use array formula so that I'm not required to have formula in each cell in column G. May I know arrayformula can achieve this or there is other method? I tried to use arrayformula(countif(B4:F4,"Yes")) but nothing come out for row 5,6,7,8. Hope to get some advice on this problem as I'm new to google sheet. Thank you.
Give this a try.
=ARRAYFORMULA(COUNTIF(IF(B4:F="Yes", ROW(B4:B8)), ROW(B4:B8)))
Edit: For the case that you describe below (only including certain columns), it's a little more involved, but the same principle works.
=ARRAYFORMULA(COUNTIF(IF(B4:B="Yes", ROW(B4:B8)), ROW(B4:B8)) + COUNTIF(IF(D4:D="Yes", ROW(D4:D8)), ROW(D4:D8)) + COUNTIF(IF(F4:F="Yes", ROW(F4:F8)), ROW(F4:F8)))
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?
I need to do a sheet to managing some informations in my job.
I'd like to make a compilation of informations filtred by month, i.e., I'd like to insert a month (B1 cell) and all the informations would be refreshed by this month.
For while I could manage this data:
Team (Equipe);
Modules (Módulos); and
Type (Tipo).
and my formula is working:
=COUNTIFS(Geral!$B$2:$B$45;$A5;Geral!$C$2:$C$45;$B5;Geral!$E$2:$E$45;C$4).
What I'd like to do is something like this:
=COUNTIFS(Geral!$B$2:$B$45;$A5;Geral!$C$2:$C$45;$B5;Geral!$E$2:$E$45;C$4;Geral!$F$2:$F$45;MONTH(B1)).
I know this formula is wrong, but I don't know how to do this... I've already tried to use arrayformula, but it didn't work...
How do I do this?
Here is the link to the sheet:
https://docs.google.com/spreadsheets/d/1NOkvkJ7B3lGcSaUTtUdrnbmdd8AjiRvniH2lM3kASSU/edit?usp=sharing
Thanks in advance!
I believe what you need is:
=ArrayFormula(COUNTIFS(Geral!$B$2:$B$45;$A5;Geral!$C$2:$C$45;$B5;Geral!$E$2:$E$45;C$4;MONTH(Geral!$F$2:$F$45);B1))
... but beware that date functions in Sheets will read a blank cell as 30/12/1899, therefore MONTH() on a blank cell will return 12. So you might want to include a test to rule out blank-ness:
=ArrayFormula(COUNTIFS(Geral!$B$2:$B$45;$A5;Geral!$C$2:$C$45;$B5;Geral!$E$2:$E$45;C$4;MONTH(Geral!$F$2:$F$45);B1;Geral!$F$2:$F$45;"<>"))
I have two Google Sheets: the first contains data per week and the second gives an overview of that data. The sheets in the first are named by week. For example: Week 1, Week 2, Week 3, Week 4 ... The sheets in the second contain one cell which has the same text as the sheet names of the first document. This cell is A1.
Using the IMPORTRANGE function I want to show some data from the first (data) document in the second (overview) document. Currently the IMPORTRANGE formula looks like this:
=IMPORTRANGE("https://docs.google.com/...; "Week 1!C2:C5")
As you can see I have to change the sheet name I reference to manually. I want it to change automatically using the text in cell A1. So it should look like this:
=IMPORTRANGE("https://docs.google.com/...; "A1!C2:C5")
Is it possible to do it like this or do I need a script and how can I make it work?
Thank you for your tip about using ranges, I will use it in the future. You suggested the following formula:
=IMPORTRANGE("https://docs.google.com/...; A1)
It didn't work. I got it to work with the following formula:
=IMPORTRANGE("https://docs.google.com/..."; (A1&"!C2:C5"))
sure, just try it:
=IMPORTRANGE("https://docs.google.com/..., A1)
I also recommemnd you use named ranges (google it). this allows you to just type in "week1" into cell A1, instead of something like "Sheet3!A1:B343." Without named ranges any complex spreadsheet will turn your formulas into an indecipherable mess.