so im trying to import data from openinsider.com this site provides information about insiders buying and selling stock in a company etc.
to pull the data need im using this =IMPORTHTML(A3,"table",12)
the html is in A3 - http://openinsider.com/search?q=GM
what i would like is for 'GM' to be easily changed to another ticker such as 'MSFT' by typing it into cell B1 is this possibe?
Using & operator will do:
=IMPORTHTML("http://openinsider.com/search?q="&B1,"table")
You should use concatenation
=CONCAT("http://openinsider.com/search?q=",B1)
Related
I'm trying to import specific data from another worksheet using the below formula. Reason being not to let other party to get hold of all the information, only the necessary data for them to work on.
Currently this formula not working. Any suggestions on how I can make it work?
=FILTER(IMPORTRANGE("https://docs.google.com/spreadsheets/d/1h2Qbxs-SuFpcPZzB3-2-VzBh3FTA9dH5_oOmtgTpBSs/edit#gid=0","Sheet1!$A:$D"),IMPORTRANGE("https://docs.google.com/spreadsheets/d/1h2Qbxs-SuFpcPZzB3-2-VzBh3FTA9dH5_oOmtgTpBSs/edit#gid=0","Sheet1!$B:$B=Nepal!$B$2"))
Im trying to get data only related to Agent Ali.
Link to the test spreadsheet: https://docs.google.com/spreadsheets/d/1h2Qbxs-SuFpcPZzB3-2-VzBh3FTA9dH5_oOmtgTpBSs/edit?usp=sharing
You mention:
Im trying to get data only related to Agent Ali.
You can use this simple query formula:
=QUERY(IMPORTRANGE("______","Sheet1!A1:D"),"where Col2='Ali'",1)
(As always do modify ranges according to your needs)
I am working with dynamic data which will populate my Google Sheet from a Form.
Basically we work with two companies at a time who assess different client opportunities. This sheet feeds into Google Data Studio.
In order to avoid manipulating the data in the sheet each time we want to display info in Data Studio, for each client that is assessed I am trying to use a formula to attach a tag in column F. Client assessed with the number 1 for the first assessment and Client assessed with the number 2. I.e: Lloyds1 or Lloyds2.
This would be easily doable if only one person from each company assessed client account but in fact it could be two or three from each company.
In the case of one person from each company i used this:
=IF(ISBLANK($D2),,(D2&COUNTIF($D$2:$D2,D2))) - worked because there would only ever be two entries
I've tried to adapt this to COUNTIFS but it doesn't work.
Hopefully I explained this problem ok and someone can help
Link to sample spreadsheet:
https://docs.google.com/spreadsheets/d/10sqp0zpThdtdRws2p2Dqs0n8IwxwBIpwk-ibH5vofGQ/edit?usp=sharing
So, I couldn't do it all in one formula as the countifs was not working for me as well. So I had to do it in a support table (which you can put in a support tab or something where you can hide it):
The support table I did was the following:
cell A2: formula: =ARRAYFORMULA(if(len(B2:B),B2:B&""&C2:C,))
cell B2: formula =unique(E2:F)
cell D2: formula =ArrayFormula(if(len(B2:B),countifs(B2:B,B2:B,row(B2:B),"<="&row(B2:B)),))
And then in the cell, you want you may have the following:
=ArrayFormula(IF(ISBLANK(E2:E),,(E2:E&vlookup(E2:E&""&F2:F,A2:D,4,false))))
It should look like this:
It is not the neatest solution, but it works and is dynamic
I am creating a home budget for myself in Google Sheets, working in Chrome on Windows 10. In the end, the budget will be composed of separate sheets for each month, containing tables for each Friday (payday) within that month. All such tables will follow a certain format and will pull arrays of budget data from an auxiliary sheet.
However, trial-and-error (mostly error) is abundant, and one quails at the thought of having to paste corrections across 52 tables. Is there any way to have each table emulate a formula set down in a template? For example, ideally, my template would contain something like:
=INDEX(IF(condition(relativeCell),namedRange1,namedRange2)
and the final product would pull that formula (with relative reference) to each table. If I discover a mistake or need to make a change, I can simply change the template, and all of the live tables would update their formulas.
Can this be done in Google Sheets?
Failing that, I already have a function that returns a cell's formula as string text. Can this be used to get the desired effect?
there is a formula called INDIRECT which does exactly that:
https://support.google.com/docs/answer/3093377?hl=en
I'm trying to get data from Google Finance in Google Sheets with this formula:
=GoogleFinance("CURRENCY:BTC")
But I'm getting this error:
GOOGLEFINANCE, the query for the symbol: 'CURRENCY:BTC' returned no data.
Although on Google Finance itself, I can get BTC prices:
https://www.google.com/finance?q=CURRENCY:BTC
with the same query strings.
How can I can fix this?
You need to have a from and to currency like this:
=GoogleFinance("CURRENCY:USDBTC")
For historic close price use:
=GoogleFinance("CURRENCY:USDBTC","close","07/07/2017")
If you want only the price returned use:
=iferror(index(GoogleFinance("CURRENCY:USDBTC","close","07/07/2017"),2,2))
As of 2020-08-15 the following formula works well (without any add-ons):
=GOOGLEFINANCE("BTCUSD")
Seems like it works only for BTC and ETH though.
2022-05-04, the following works on Google Sheets:
=googlefinance("CURRENCY:USDBTC") as well as most combinations of currency and BTC (and ETH, LTC, BNB, XRP, XLM, and ADA), for example GBPBTC and JPYBTC.
=googlefinance("CURRENCY:BTCUSD") works too, in the same combinations of coin and currency.
Although finance.google.com has DOGE and LINK pricing, they don't seem to work the same way in the Sheet's googlefinance function.
Another way to work with crypto currency is to use the add-on where you can extract data from other sources.
=CRYPTOFINANCE("BTCUSD")
Link below:
https://jbuty.com/how-to-get-crypto-currencies-rates-and-more-in-google-sheet-1a57e571bc14
This question already has answers here:
Scraping data to Google Sheets from a website that uses JavaScript
(2 answers)
Closed last month.
I'm trying to import current stock price from yahoo finance. I used a formula from some website and it partially work. I only know how to tell it to look for a specific query and it worked fine for some other data point I need but the price change query changes from
"Fw(500) Pstart(10px) Fz(24px) C($dataRed)"
to
"Fw(500) Pstart(10px) Fz(24px) C($dataGreen)"
depending if the price is up or down for the day.
How do I modify the formula I'm using below to use the "or" operator in this case? so that it will pull the price down whether the stock is up or down for the day. Thanks!
Formula I'm using:
=IMPORTXML("https://finance.yahoo.com/quote/IBM","//span[#class='Fw(500) Pstart(10px) Fz(24px) C($dataRed)']")
I noticed the other answers did not work for me (they may have worked in the past), so I decided to post this solution. Just put the ticker in cell A1 and one or both of the below formulas somewhere else.
Price:
=IFNA(VALUE(IMPORTXML("https://finance.yahoo.com/quote/" & A1, "//*[#class=""D(ib) Mend(20px)""]/span[1]")))
Change:
=IFNA(VALUE(REGEXEXTRACT(IMPORTXML("https://finance.yahoo.com/quote/" & A1,"//*[#class=""D(ib) Mend(20px)""]/span[2]"), "^.*?\s")))
Currently using googlefinance but find it does not update often enough even when updates set to every minute so currently testing if below will allow updates at least with an F5 press within the sheet
This brings in the price and other information (dated 2022/09/27)
=IMPORTXML("https://finance.yahoo.com/quote/SAVA/", "//*[#id=""quote-header-info""]/div[3]/div[1]/div[1]")
If you just want the price: =IFNA(VALUE(IMPORTXML("https://finance.yahoo.com/quote/" & $A1, "//*[#class=""D(ib) Mend(20px)""]/span[1]")))
You could use a more dynamic/generic xpath that doesnt require such specific paths such as this:
This one pulls in both the price and the change:
=ARRAY_CONSTRAIN(transpose(IMPORTXML("https://finance.yahoo.com/quote/IBM:,"//*[#class='Mt(6px)']//span")),1,2)
If you just want the price:
=trim(IMPORTXML("https://finance.yahoo.com/quote/IBM","//*[#class='Mt(6px)']//span"))
If you just want the change:
=IMPORTXML("https://finance.yahoo.com/quote/IBM","//*[#class='Mt(6px)']//span[2]")
Sadly Yahoo Finance changes the XML/HTML structure of its website quite often. The one that works for now is:
=IMPORTXML("https://finance.yahoo.com/quote/IBM/", "//*[#id=""quote-header-info""]/div[3]/div[1]/div/span[1]")
You may always open the HTML structure and use the developer tools to find and copy the X-path.
P.S.1. Though there seem to be a bug and the function can't retrieve data from URLs where there is a dot/point/period "." in the name.
P.S.2. The IMPORTHTML() function can't also fetch the latest price from Yahoo Finance because the information is neither in a table nor a list. You can try the scripts from this page and this page to list all the tables and lists.