Google Spreadsheet ARRAYFORMULA() with INDIRECT() and ROW() - google-sheets

I have a google spreadsheet in which I enter daily income and expenses:
On another sheet, I am trying to calculate the monthly income and expenses for every month:
I am using this formula to calculate the monthly income ('s1' is the daily sheet):
=ARRAYFORMULA(SUM(FILTER(s1!B2:B; MONTH(s1!A2:A)=MONTH(INDIRECT("A" & ROW())))))
but it does work for the whole column.
Is there any way to make the arrayformula work with the indirect and row functions?

I think this would work as a SUMIF instead - try:
=ArrayFormula(IF(A2:A="",,SUMIF(MONTH(s1!A2:A),MONTH(A2:A),s1!B2:B)))

Related

How to count dynamically orders of each month incrementally in google sheets

I want to count orders for each month by incrementing each order and resetting them for the next month in a dynamic fashion, like this.
I tried COUNTIF function to count the range of MONTH but the out put is the count if all the range, Take a look at the Sheet.
As per your provided sheet try below formula-
=Arrayformula(IF(D2:D="",,COUNTIFS(D2:D, D2:D, ROW(D2:D), "<="&ROW(D2:D))))
Actually you do not need helping Month column. You can achieve your desired result directly using below formula.
=Arrayformula(IF(B2:B="",,COUNTIFS(Month(B2:B), Month(B2:B), ROW(B2:B), "<="&ROW(B2:B))))

Using SumProduct With Array Formula in Google Sheet

I have a problem to use sumproduct with array formula in Google Sheet which seems workable in Excel. The formula returns only 1st array value (E8*F8) which what I have to do is to get total sales price from everyday.
Below is the formula I used:
=SUMPRODUCT(ARRAYFORMULA(INDEX(E8:J8,,column(A1:C1)*2-1)),ARRAYFORMULA(INDEX(E8:J8,,column(A1:C1)*2)))
Below is the table view:
My Spread Sheet Link
Try this formula
=SUMPRODUCT(ARRAYFORMULA(FILTER(E8:J8, ISEVEN(COLUMN(E8:J8)))), ARRAYFORMULA(FILTER(E8:J8, ISODD(COLUMN(E8:J8)))))
Or even simpler
=SUMPRODUCT({E8,G8,I8}, {F8,H8,J8})

How to calculate monthly std deviation of daily returns in google sheets using google finance api

how to calculate monlthy std diviatoin of daily returns in google sheets using google finance api?
I think we need to use QUERY()but I am not sure how to form single data set in QUERY() by calling googlefinance() two times
So far
:
My stock symbols are in Column A in sheet .
I want to calculate monthly volatility as mentioned in
https://www.investopedia.com/articles/investing/102715/computing-historical-volatility-excel.asp
I want have a colum that has monthly history volatility against the symbol in colum A :
=QUERY(QUERY(
{
ARRAY_CONSTRAIN(GOOGLEFINANCE("NSE:"&A2, "close", workday.intl(TODAY(),-5), workday.intl(TODAY(),-1), "daily"), 4, 2),
ARRAY_CONSTRAIN(GOOGLEFINANCE("NSE:"&A2, "close", workday.intl(TODAY(),-6), workday.intl(TODAY(),-2), "daily"), 4, 2)
},
"select Col2",
1), "offset 1",0)
With above query, I am able.to get data range which has last N day price in 1st colum and prev day price in colum 2.
I would like to use and extend this to calculate monthly volatility.
I am not sure how to use this price data range to calculate logarithm and and next calculation.
Thanks
This may be an over-simplification of what you're trying to achieve, but can you use the STDEV function on a range of closing values during a month?
=stdev(query(googlefinance("NSE:"&A2, "close", MonthStartDate, eomonth(MonthStartDate,0), "daily"),"select Col2 offset 1",0))
MonthStartDate would be your cell 'named range' containing your month start. Obviously, days, where the markets are closed, would not bring back a value and the STDEV would reflect this.
If the closing price is too simplistic and you need other attributes, then you could combine them in the query.

Google tabs IMPORTRANGE with SUMIF problems

I know it has already been a few times discussed topic, but I haven't found any help that would suit my problem yet.
I'm trying to make a sum of numbers in one column in a different Google sheet. The problem is I need to sum only those numbers happened in chosen month. I have the number of the month in the sheet where I need the function, and I have the month specifikation in a column next to the numbers.
All I came to till now is this (after many totally different codes):
=sum(query(IMPORTRANGE("xyz";"Výkaz!B23:C125");"select Col2,Col3 where "col2=G4";0)"))
G4 is the chosen month I have in the same sheet as this code
Please, could you help me figure this out? Thank you
Google Sheet 1 (TabName = "externalTab")
Google Sheet 2 (TabName = "InternalTab")
Use importrange to pull the all data from "externalTab" to "Internal Tab". Then just use a sumifs formula to add up values based on your criteria.
=IMPORTRANGE("https://docs.google.com/spreadsheets/d/1sLPGZkAVlxWfjhDMU9oa_cww0AI570Rtem0XCoOx0AE", "'externalTab '!A1:AF2000")
Alternatively use the following formula. Integers to be summed are located in column a/Col1 and Months are located in column b/Col2. There is one header row on the spreadsheet and we are adding up all the Integers that correspond to the month June.
=sum(query(importrange("https://docs.google.com/spreadsheets/d/1sLPGZkAVlxWfjhDMU9oa_cww0AI570Rtem0XCoOx0AE","a1:b1000"),"select Col1, Col2 WHERE Col2 = 'June'",1))

Calculate weekly sum in spreadsheet using array formula

I'm trying to calculate weekly sums in a single column, but I'm having trouble writing the formula. I'm found the the weeknum for every date in the year, but I can't find a way to sum up values if they have the same weeknum.
Link to my spreadsheet: https://docs.google.com/spreadsheets/d/1WIeBpRndO9ZBlkCcWQuNO1X4e9I6bGeQiYDTZqhaOeA/edit#gid=0
I'd like column "D" to automatically calculate the weekly sum using an array formula -- is there a way to do this?
This thread introduces the problem: Calculate weekly and monthly total in spreadsheet.
Chang sum() to sumif()
=ARRAYFORMULA(IF(ROW(A:A)=1,"Weekly Sum", IF(WEEKDAY(A:A)=7, sumif(C:C,C:C,B:B),)))
You have: A2:A with dates and B2:B with values. So:
F2=arrayformula(if(isblank(A2:A),,weeknum(A2:A)))
G2=if(F2<>F1,sum(iferror(filter(B$2:B,F$2:F=F2),0)),0)
And then copy G2 through G3:G.

Resources