How can I load EBITDA and TotalEquity for ticker in GoogleSpreadsheet? - google-sheets

I have a GoogleSpreadsheet showing me super data about price, high and low. But currently, I check manually EBITDA and Total Equity before to buy.
Is there an approach to load this data to Google Spreadsheet automatically? Currently even =GoogleFinance("KMI", "netassets") does not work -- returns #N/A

Related

Google sheets - How to import revenue from Google Finance

I have a gsheet, where in the column A there are plenty of listed companies' (from different stock exchanges) tickers. In column B and C I need to have a data regarding Market Capitalization and Revenue for each company respectively. For Market Cap I've just used Googlefinance formula, but unfortunately due to its limitation I am unable to import the financial data.
I've tried "=IMPORTXML("https://www.google.com/finance/quote/TICKER","//table//tr[contains(#class,'roXhBd')]")" but unfortunately it returns only quaterly data, and I have no idea how to convert it to display annual values.

Google Finance does not show last closing price after market hours. It just shows last *traded* price instead of *closing*

My query is on stock market of India where I fetch the quotes from =googlefinance function in my google sheet. I was very disappointed to know that the function does not show last closing price. Instead, it shows the last traded price.
Lets take an example of a stock RELIANCE:
=GoogleFinance("NSE:reliance", "price") result is 2498.00 which is incorrect.
Actual closing on Friday, 16 Sep 2022 was 2499.20 as per official National Stock Exchange of India. You may refer to this link for the Close price and the screenshot below
The incorrect quote 2498.00 is the last traded price before market closing
The correct quote is 2499.20 when the markets were closed.
This behavior is common across all stocks of Indian stock market. I have used almost all the parameters those are available in the =googlefinance function but I could not find a way to get the correct stock quote.
Then I decided to scrape the value from the official website using the following without success
<div id="closePrice">2,499.20</div>
//*[#id="closePrice"]
/html/body/div[2]/div[4]/div[2]/div[1]/div[4]/ul/li[6]/div[1]
document.querySelector("#closePrice")
I searched a lot of valuable articles on this site and also on google but could not find a solution which would fetch the desired result. Can someone help me with a way to get 2499.20 as a result for RELIANCE stock either using =googlefinance function or by scraping the value from office website?
Thank you.
Solution suggested by #TheMaster (Thank you so much!)
=LAMBDA(gf,INDEX(gf,ROWS(gf),2))(GOOGLEFINANCE("NSE:RELIANCE", "close",TODAY()-5,15))
Two other ways
=index(GOOGLEFINANCE("NSE:reliance","Close",today()-5,15),4,2)
=query(GOOGLEFINANCE("NSE:reliance","Close",today()-5,15),"select Col2 where Col1 < date '"&TEXT(today()+1, "YYYY-MM-DD")&"' order by Col1 desc limit 1",False)
I am also keen to know which one of these or other methods (if any) will get the results faster without crashes or any other processing issues as my googlesheet is loaded with thousands of stock quotes which will be refreshed every 1 minute.
Only historical prices support close attribute. Use the start date argument to get historical prices and get the last close:
=LAMBDA(gf,INDEX(gf,ROWS(gf),2))(GOOGLEFINANCE("NSE:RELIANCE", "close",TODAY()-5,15))
This is another way of achieving the result.
=query(GOOGLEFINANCE("NSE:reliance","Close",today()-5,15),"select Col2 where Col1 < date '"&TEXT(today()+1, "YYYY-MM-DD")&"' order by Col1 desc limit 1",False)
When I compared performance of both the solutions =LAMBDA and =QUERY on 2500+ stocks, I found query to be more faster than lambda.
Cheers!
However, my main query remains unresolved as no formula of google finance gives today's close until the actual day is over.

referencing a grouped date column using GETPIVOTDATA in Google Sheets

I'm doing an analysis of sales data in Google Sheets and I'm building a dashboard with information about different sales reps. I'm trying to use the GETPIVOTDATA function to reference a year-quarter group in my pivot table, but I can't get the function to return the correct value.
In the pivot table, I have specific timestamps grouped by year-quarter and organised as columns. I have the individual sales reps and their teams organised as rows:
[Google Sheets pivot table]. I want to use GETPIVOTDATA to get the number of SQLs for a specific sales rep in a specific quarter.
The function will only return the Grand Total for the sales rep (column F in the picture), or if the Grand Total is disabled in the pivot table, it returns a #REF! error.
I tried many iterations of the GETPIVOTDATA function. I also tried making a helper column in the original data that lists the specific year and quarter instead of the timestamp. Neither of these worked.
I realise that I can use an INDEX MATCH or VLOOKUP instead, but I want to be able to change the pivot table later without having to change the formula.
If anyone knows what I'm doing wrong (or if what I'm trying to do is even possible with a GETPIVOTDATA function) I'd really appreciate advice! I can't seem to figure it out.

Linking a fixed spreadsheet and a moving spreadsheet by cell value

I work for a small business that depends quite a lot on the weather. I’m trying to create a spreadsheet (in google sheets) to predict daily revenue. At the moment the spreadsheet simply multiplies last year’s corresponding day by the growth percentage to get this year’s daily values. I’m trying to include the weather forecast (15 days) in the calculation. I’ve managed to import the forecast successfully using an api tutorial that I found online (https://www.visualcrossing.com/weather-data), and include the forecast values in the revenue calculation.
Now for the issue:
*the revenue prediction is a spreadsheet with every row being a day of the year, making the spreadsheet 365 rows long
*the imported forecast (in another tab, not sure that’s relevant) is only 15 rows long and updates every day, meaning that it remains that length. No new row is added during the update: the data just shift one row up and the first day disappears while a new day takes the bottom row.
My formula in the revenue tab identifies the weather data in the weather tab by row but when I pull the formula down for the whole year (down 365 rows, that is), only the first 15 rows refer to existing data in the weather tab. -> Not only are the results obtained based on the wrong row as soon as the weather tab updates on day 2, but they are also referring to totally empty cells from day 16 on.
So my questions are:
*is there a way to force the daily weather forecast to remain on its row and add a new row every day, or failing that,
*is there a way for the formula to recognize the matching day cells and use the value of the cell x columns to the right of it, effectively skipping the row referencing altogether
I’ve added a very simplified sketch of the spreadsheets for the more visual helpers out here
Apologies if this is unclear, I do not have a tech background but am happy to clarify anything if needed.
-- Edit: Here is a screenshot of the revenue tab. The expected output is in column K. The values in it at the moment are incorrect.
Seems like you just need a dynamic way to match the dates? I can't tell if you meant to have prior year data in other tab, but this spreadsheet matches your example and returns the value irrespective of the row order.
The formula being used (in the top row) is:
=B1*index(WeatherTab!B:B,match(A1,WeatherTab!A:A,))*index(WeatherTab!C:C,match(A1,WeatherTab!A:A,))

Average instead of Sum in Grand Total of Pivot Table in Google Sheets

In Google Sheets, is there any way that the "Grand Total" of a column in a Pivot Table is something different than the values of the column represents? (for instance, in a sum column, show the average).
An example would be in a sheet with daily sales of several products. You want in the column for each product to show the yearly sales (sum column), but the grand total to show the average of the values in the column.
This is very easy to do in Excel, since you can configure the Grand Total to be other function. I have not been able to find the same functionality in Google Sheets.
Edit: Original question was badly formulated.
Though it reads Grand Total, the presented result depends on the choices you make on Summarise by as clearly seen in the image.
In our example for Days the Grand Total is the average of all days.
For Points the Grand Total is the minimum of all points

Resources