Formula converted to arrayformula not working - google-sheets-formula

I want to convert below google sheet formula to arrayformula, please guide.
=MAX(0,if((G3\>0)\*ISNUMBER(G3), MINUS((today()-K3),SUM(EOMONTH(K3,0)-K3,10)),G3))
I want to convert this in array
basically k3 is a last date that i want to substract from todays date in a list

You should add ranges instead of specific cells. So it should be something like this:
=ARRAYFORMULA(IF((G3:G>0)*ISNUMBER(G3:G),(today()-K3:K)-((EOMONTH(K3:K, 0)-K3:K)+10), G3:G))

Related

Referencing a date from a cell in google sheets

I am trying to track stock prices with Googlefinance function in Sheets. I can pull the price for a date with =INDEX(GOOGLEFINANCE((B2),"price",date(2019,12,13)),2,2) which is fine but I want to input the date with Column A which has date data. So, (A1) instead of (2019,12,13)but for some reason I get errors.
This seems simple but I cannot get it to pull the date from my column. Ive tried removing DATE and just using the cell but this also doesnt work.
the formula that worked for me is
=index(GOOGLEFINANCE("YOUR_STOCK", "price",A1),2,2)
If, like you said, you already tried that and it did not work, you should link us a test sheet with your formula.
make sure A1 is really a date. you can check this with
=ISDATE(A1)
the output should be TRUE. your formula is correct:
=INDEX(GOOGLEFINANCE(B2; "price"; A1); 2; 2)

Google sheets Countif function with UTC timestamp

I am trying to count number of IDs that exist as of a particular date (see Summary tab). However, since the dates (column A) in raw data tab are in UTC timestamp format, the formula returns 0.
My formula is countif('raw data'!A:A,"<="&A2)
How do I adjust the formula to convert UTC timestamps to datevalue within countif function.
I also would like to make this countif function work with arrayformula so that I don't have apply the formula on each row.
Here is the sample sheet :
https://docs.google.com/spreadsheets/d/1IFAAiguhKD0xK8SYsnzMBSar4IFAQPzZfIh0U44bZWI/edit?usp=sharing
Translate first your dates by
=arrayformula(if(A2:A="",,VALUE(left(A2:A,10))))
You can use
=sumproduct(('raw data'!D:D<=A2)*('raw data'!D:D<>""))
Now, if you want arrayformula to be applied, first make a query
=QUERY('raw data'!A:D,"select D,count(B) group by D")
then compute a total as following
={"Total ID";ArrayFormula(if(isblank(G2:G),,mmult(1*(transpose(row(G2:G))<=row(G2:G)),1*G2:G)))}
both formulas are on yellow cells

How to compare columns in a new column

I have a recordset where rows have a date field.Rows are from current year and last year. I want to see the count of rows per year. That's easy. Now I'd like to have a third column with difference (count(currentYear) - count(lastYear)). Is there any way to achieve this?
thanks
It seems like you want to have the difference calculated between two members of the same date field.
If so, you might want to consider the customizeCell() API call to retrieve the count values of each year, use them to calculate the difference, and modify the necessary cells with the result.
Alternatively, you could try modifying your data set so that the lastYear and currentYear are two different fields – this, for example, would allow you to compare them within a calculated value.

Sort Google Sheets spreadsheet by date, not by string

I use Google Sheets to keep a list of applications I am doing. In each row there is a date field. I want to sort by date now. The first row is frozen using View - Freeze - 1 row. When I select the whole table, press Data - Sort range... and then check Data has header row the sheet is sorted. But not by date but by string. The format of the cells is date. Is only string sorting possible? If yes, I would have to reformat the whole document to dates like 2017-01-11, correct?
The solution was to replace the . by /. Seems as if the common german format using . is not yet supported. Make sure the date is recognized as date. If the cell is right-aligned it worked, if not it did not work.
I learned that you can create a custom date format using the ..
Now the date is entered 10/01/2017 but displayed 10.01.2017. Just the way I wanted.

Google Sheets - Sum values based on date range

I have a column of dates, column C, and a column of values, column G. I want to be able to calculate monthly totals of column G. I've poked around and found that you can use sumif or you can use a filter. The filter method seems easier. I've tried the following but it doesn't work.
=sum(filter(C3:C365,G3:G365>date(3/1/2016),G3:G365<date(3/31/2016)))
How can I check the dates in column C and then sum up the values from column G?
Thanks Rich
Try:
=sumproduct(MONTH(C2:C) = 3,B2:B)
Three is the month number (March).

Resources