Above is an example of data in Google Sheets. The green table is to keep track my purchases and the red table is to show the inventory summary.
I am stuck at creating a formula to calculate the Balance Stock Cost.
The Balance Stock Cost should only sum up the cost of unsold quantity from latest received date.
For example, for SKU A, the stock balance is 31 units. The purchases of SKU A sorted by received date will become like this...
Since the stock balance is 31, the formula should sum up the purchases on 10-Jan (5 units x 6), 7-Jan (25 units x 4) and 5-Jan (1 unit x 5.5) which brings the total to 135.5.
Please help me to come up a formula to calculate the Balance Stock Cost based on above requirements. Thanks.
You can try:
=MAP(A18:A,D18:D,LAMBDA(ax,dx,IF(ax="",,SUM(QUERY(SORT(ARRAYFORMULA(split(flatten(A2:A15&"|"&B2:B15&"|"&D2:D15&"|"&MAP(C2:C15,LAMBDA(cx,TRANSPOSE(SEQUENCE(cx,1,1,0))))),"|",0,0)),1,1,2,0),"Select Col3 Where Col4 is NOT NULL AND Col1='"&ax&"' LIMIT "&dx)))))
Related
I want to multiply a range by another range in another sheet only If a month in a date from a range matches the month in another range in another sheet.
Technically:
Multiply $R$8:$R$1007 by Start!$L$13:$L$24 If ARRAYFORMULA(TEXT($N$8:$N$1007,"MMMM")),"="&Start!$K$13:$K$24
Edit: here's a sample of my tables:
https://docs.google.com/spreadsheets/d/1A0zZ1BvRnjeQQjsf4RoRGesOPNYOJWzlr9Kh2oYto-Y/edit?usp=sharing
I want the income from US dollars to another currency with conditions.
So in other words column T in sheet Transactions to be equal to the multiplication of the income in US dollars by the exchange rate in column L in sheet Start only If the month from column N equals in sheet Transactions the column K in sheet Start.
How can I right turn this into a functional formula, please?
try:
=ARRAYFORMULA(IFERROR(VLOOKUP(MONTH(N8:N),
{MONTH(Start!K13:K24&1), Start!L13:L24}, 2, )*R8:R))
Based on the limited information of your sheets. The following would multiply and sum each range if the months are matching:
=SUMPRODUCT(--(TEXT(N8:N1007,"mmmm")=Start!K13:K24),R8:R1007,Start!L13:L24)
I have 2 sheets in Google Sheets:
All contacts w. week/month/year, where we pull all of our deals for the year
Weekly Marketing analytics, where we match up all of this information on a weekly basis
In the Weekly Marketing analytics, every column from B2 to BB2 is a week number (1-53), and A1 is the current year (2021 with this sheet).
I am currently trying to find and sum, every deal value on a 10 week running average (week 1-10, 2-11 etc.) and in order to do that, I've created this formula:
=SUMIFS('All contacts w. week/month/year'!$D:$D;'All contacts w. week/month/year'!$T:$T;$A$1;'All contacts w. week/month/year'!$Q:$Q;C$2:L$2; 'All contacts w. week/month/year'!$E:$E; "ORGANIC_SEARCH")
'All contacts w. week/month/year'!$D:$D - This is the column with all of the revenue for a given deal.
'All contacts w. week/month/year'!$T:$T;$A$1 - This is the column with the year of the deal.
'All contacts w. week/month/year'!$Q:$Q;B$2:K$2 - This is the column I am having trouble with. This is the column with the week number of the deal, and since I am doing a 10 week running average, I want every deal for the last 10 weeks. So all deals from week 1, 2, 3 etc that matches all of the other criteria.
'All contacts w. week/month/year'!$E:$E; "ORGANIC_SEARCH" - This is the last criteria, defining which marketing channel the deal originated from.
Currently this formula returns 0, despite there being a deal in week 4, and I cant work out why the system is missing it?
In the bigger picture, this is the for I want to end out with:
=IF(SUM(C$116:L$116)>0;SUM(SUM(C$143:L$143)/SUMIFS('All contacts w. week/month/year'!$D:$D;'All contacts w. week/month/year'!$T:$T;$A$1;'All contacts w. week/month/year'!$Q:$Q;C$2:L$2; 'All contacts w. week/month/year'!$E:$E; "ORGANIC_SEARCH")); 0)
Quickly checking if there is any deals counted in those weeks, if yes then sum up the marketing cost for a given channel, divided with the revenue of the deals for those given weeks.
It's hard to say without seeing the actual data, but it looks like the Criteria2 argument is problematic, because C$2:L$2 is really an array of criteria. So depending on your version of Excel, it would return either a spilled array or the first element of the array (basically only using C$2 as a criteria.)
If the week numbers are numeric (1,2,3 etc.) instead of text (Week1, Week2, Week3, etc.) then you ought to be able to break it out into 2 criteria using inequalities. For example, suppose L2 is week 11. That means the expression L2-9 provides your lower bound of 2. So in your SUMIFS function you should sum everything greater than or equal to L2-9 AND less than or equal to L2.
Your formula might look something like this:
=SUMIFS('All contacts w. week/month/year'!$D:$D;'All contacts w. week/month/year'!$T:$T;$A$1;'All contacts w. week/month/year'!$Q:$Q;">=" & L2-9; 'All contacts w. week/month/year'!$Q:$Q; "<=" & L2; 'All contacts w. week/month/year'!$E:$E; "ORGANIC_SEARCH")
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.
Hi everyone,
I have 4 ranges of data:
A1:C5 (Product In Storage), there will be new data input if there are other new products coming in.
E1:G8 (Sales), this is the record for all the products that are being sold, there will be new data input also in the future.
I1:K5 (Summary of Sales), this will record the Quantity Left in the storage and also the total Profit or Loss after doing some calculation based on A1:C5 and E1:G8. The number of rows for Summary of Sales should be equal to the number of rows of Product In Storage (So I'm using query function highlighted in yellow).
M1:O5 (Desired Output), this is the final result that I want to achieve for this task.
My goal is to calculate the Quantity Left & Profit or Loss in Summary of Sales automatically once there are new data input in Product In Storage & Sales.
I'm not sure how to do it because the number of rows in Sales is a not a constant. In this example, the are 2 rows data for Product ID: 1001.01 & 3 rows data for Product ID: 1002.01. In the future, after the remaining quantity (34) for Product ID: 1001.01 had been sold, it need to be included in the Summary of Sales as well.
I attached the google sheet link below in case you need it: https://docs.google.com/spreadsheets/d/17coke3-oyDRLHgz79PDl3KX68kFOEte-aynVe-xEITU/edit?usp=sharing
Is there anyway to do this without using the google apps script? Any help will be greatly appreciated!
For your example,
J4 -> =SUMIF(A:A,I4,C:C) - SUMIF(E:E,I4,G:G) means;
(First sumif, get inventory) Whenever you see I4 in A:A column, get the C value on that row and sum all of them.
(And minus)
(Second sumif, minus sales) Whenever you see I4 in E:E column, get the G value on that row and sum all of them.
(Result) = Get storage quantity and substitute the sales quantity.
K4 -> =ArrayFormula(SUMPRODUCT(IF(E:E=I4,F:F*G:G)) - SUMPRODUCT(IF(A:A=I4,B:B*C:C)))
means,
(get income) if you see I4 on E:E column, then get the sum of (F*G)
(minus)
(get expense) if you see I4 on A:A column, then get the sum of (B*C)
But if i were you, to keep things more simple, i would put =Quantity*Price right of your tables and you can solve problems with only =SUMIF formulas. FYI, this will update everytime you change a value from table so when things get nastier, it will become slower indeed. When that time comes, a VBA macro button or Formulas->Calculation method will save your day.
Example
Column B is my monthly sales goal.
Columns E,F,G,H, etc are the number of sales in a given day.
When I meet my monthly goal, Column C will display 100%.
In Column D I would like to display the date asscoiated to the column of the last sale when our monthly sales goal is met.
The equation I have right now for Cell D is:
=IF(C2=100,D=
Try:
=IF(C1=100,"Day Goal Was Met","")