vohratom
vohratom

Reputation: 482

ARRAYFORMULA with GOOGLEFINANCE function

I want to create a simple function that returns company name for every line that is filled with the Symbol via GoogleFinance function, however, I am not able to make the script work for every line.

Here is the example:

https://docs.google.com/spreadsheets/d/1cJDq0smLUmbylAnAep3WIz41GvqH_dhpnLjnLEpOmAQ/edit?usp=sharing

CODE 1:

// DOES NOT WORK    
=ARRAYFORMULA(IFS(ROW(B:B)=1,"NAME",A:A="","",TRUE,VLOOKUP(GOOGLEFINANCE(A:A, "name"),GOOGLEFINANCE(A:A, "name"),1,0)))

Once I change the A:A to A2 it loads the data correctly, but I did not find a way of repeating the function for each row

I tried a workaround:

// DOES NOT WORK
=ARRAYFORMULA(IFS(ROW(B:B)=1;"NAME";A:A="";"";TRUE;VLOOKUP(GOOGLEFINANCE(CONCATENATE("A";row()); "name");GOOGLEFINANCE(CONCATENATE("A";row()); "name");1;0)))

But the same result..

Any ideas how to make it work?

Thank you in advance!

Upvotes: 3

Views: 651

Answers (2)

Suresh Patel
Suresh Patel

Reputation: 1

[https://docs.google.com/spreadsheets/d/1XKggLTU3_R7XghdeBAa-JOA2E23Zasrg5zJY_-gnVX0/edit?usp=drivesdk] 1Vohratom C:C is undefined, nest with bycol and its range define in LAMBDA,it will work.

{"DIVIDEND"; BYROW(A2:A; LAMBDA(r;BYCOL(C2:C;LAMBDA (c,IF(c="Dividend";IFNA(SUBSTITUTE(IMPORTXML(CONCATENATE("https://finviz.com/quote.ashx?t=";r);'XML IMPORT'!C$3)));".";",")/4);"-")))}

Check 2 close parenthesis ,if I was misplaced

Upvotes: 0

Osm
Osm

Reputation: 2881

Use this

=BYROW(A2:A, LAMBDA(r, IF(r="",,GOOGLEFINANCE(r, "name"))))

enter image description here

Or this with the header

={"Name";BYROW(A2:A, LAMBDA(r, IF(r="",,GOOGLEFINANCE(r, "name"))))}

enter image description here

Upvotes: 5

Related Questions