Hi, who can help me, on how to use CASE WHEN statement. Where I am intend to sum a net profit by grouping Income Accounts code - netsuite

I try to use CASE WHEN Statement to group Income Accounts in Saved Search by it doesn't work.
I am expecting that I want to group the account of Revenue in a column, and account of COGS in another column, and calculate the to have Sum of Gross Profit. For example (Revenue - COGS = Gross Profit).

Related

weighted average with sumproduct and offset

I would like to do the following: Calculate a weighted average based on the scenario shown in the sample screenshot. The question I would like to anser is: What is the total amount of sales generated by employee A and employee B, respectively, in a given period (here: in 2021).
Screenshot:
My Idea was to use a sumproduct formula which selects first all items with reference to employee A and, secondly, all sales of a given product. I use the ISNUMBER(FIND()) construct as wildcard (e.g. with *) does not work with SUMPRODUCT() as far as I know. However, this formula does not work properly. Any suggestions?
=SUMPRODUCT(--(Table1[item]=$J46);Table1[2021];--(ISNUMBER(FIND("Sale";TabLe1[item])));Table1[2021])
Office 365 required:
=SUMPRODUCT(FILTER(Table1[2021],LEFT(Table1[item],4)="sale"),FILTER(Table1[2021],Table1[item]=$J46))
For older Excel version you could use:
=SUMPRODUCT((Table1[2021])*--(Table1[item]=J49),.
(OFFSET(Table1[2021],1-MATCH(J49,Table1[item],0),,))*
--(LEFT(OFFSET(Table1[item],1-MATCH(J49,Table1[item],0),,),4)="sale"))
This is provided that each employee is offset the same way for each sale product.

Choose correct PRODUCT COST from ROW based on amount sold

I am making a sheet to CALCULATE REAL REVENUE from each sale I make on my online store.
The problem is that the COST of my products is not always constant. It varies depending on many factors so each time I make a purchase I add the NEW PRODUCTS COST (LATEST COST).
Each time I make a new purchase I will add the QUANTITY and the new COST. (PURCHASE 1, PURCHASE 2, PURCHASE 3,etc).
Screenshoot of my sheet with example on ROW 41
In Column B I want to know which is the CURRENT COST based on the amount of TOTAL SALES of each product.
For example:
If I have sold less than 100 ( Pruchase 1 QUANTITY) then I need the formula to choose value of E41 (PURCHASE 1 COST).
If I have sold MORE than 100 and LESS than 300 (which is the SUM of PURCHASE 1 & PURCHASE 2) I need the formula to choose value of G41 (PURCHASE 2 COST) AND SO ON...
The formula I have come up with so far is this:
=INDEX(41:41,,IF(C41<=D41,COLUMN(E41),IF(C41<=D41+F41,COLUMN(E41)+2,IF(C41<=D41+F41+H41,COLUMN(E41)+4,COLUMN(E41)+6))))
This formula WORKS but only for the first 3 PURCHASES.
I need a formula that has no limit but I don't know how to make a VARIABLE formula.
Please take my words literally when I say that I wouldn't waste one minute on trying to solve your problem with your current sheet design. You would need VBA, and then extract quantities and prices from each purchase without the ability to filter on columns. (Minute is up.)
What you need is a Purchase database: ItemID, Date, Quantity, Price, maybe Ref#. From that you can pull out the transactions for any item by filtering on the item and the cost by using functions like SUMIF. However, this just brings the real problem within reach without solving it.
The problem is that when you buy 100 pcs #42 your price is 42. Then you buy another 100 pieces #46 your average price is 44. But if you sold 50 pieces with a cost of 42 then the average cost of the remaining 150 is 45. Therefore you can't determine the average cost of any remainder without knowing the quantity sold and the average cost applied to that sale. To solve that problem you will still need VBA but the suggested db format of purchase record would at least support such a solution.
Not so long ago I programmed a solution where there were additional columns in the db and each sale was recorded in 3 columns (much like your present purchase record): date, Qty, Ref. In this way I could trace the sale of each individual purchase (this was for shares trading). The sale of the newer quantity wouldn't start until the earlier quantity was sold out.
Perhaps you don't need to trace where the purchased quantity went to and just need one column to count down the balance to zero. That would be much simpler but has the drawback that you can't roll back errors. In the end the rollback was the reason why I abandoned the design. The key to the ability to abandon it is a similar db for sales: date, qty, price, Ref#.
With such a setup you might design a system to either extract the average or FiFo price from the purchase side and associate it with a sale. If the condition is that it should be done with worksheet functions you could add a column for "current cost" in the purchase db, changing with each purchase, which you look up by date from the sales side using VLOOKUP or SUMPRODUCT, having set a cost price applicable from the day of purchase until the next. If that appeals to you, a method must be found to deal with days on which there are both purchases and sales.

How to get the exact value using excel function or VBA in Two Columns

Hy, I am using a spreadsheet template, to calculate the Franchise Fee and Market Fee on each sale. The idea is that I will pay the franchise fee onetime, either in multiple sales or in a single sale and the total franchise fee should be only $3000, not less or greater when the fee will $3000, I will not bound to pay franchise fee on other sales. This scenario is the same for the market fee, but the market fee which I will pay is $20,000, and if I paid this fee in single or multiple sales, after this, I will not bound to pay this fee. I am trying it to solve it using the formula below but it is not giving me the exact amount. It is exceeding the limit.
=IF(SUM($H$9:H9)>3000,0,G10*$H$6) and =IF(SUM($I$9:I9)>20000,0,G10*$J$6)
The Sheet layout is as under.
So I need the total of each fee should be $3000 and $20,000 for each category respectively. The breakup of the fee will be based on the Fee Rate written in Cell H6 and J6 respectively. I tried nested Ifs but could not find the exact amount. Any suggestion,s, please. Thanks
Here is more concise info.
Limit the last payment to Max - Current Sum
ie.
=IF(SUM($H$9:H9)>=3000, 0, MIN(3000 - SUM($H$9:H9), G10*$H$6))

Excel: Formula to help calculate profits

I am stuck and have been watching videos and googling a lot today.
My problem is that i need to calculate the tax to deduct as well as deduct the wholesale cost of the product on an excel spread sheet.
There are 3 regions east, west and central all with different tax amounts.
East is an $0.15 tax with a $50$ price deduction
Central is an $0.18 tax with a $40 price deduction
West is an $0.18 tax with a $30 price deduction
Revenue before tax - E2
Region - B2
enter image description here
I have tried =IF(B2="east",G2*0.15, '')IF(b2="central",G2*0.18,'')
I am unsure what to put in the if false slot or if I'm even on the right track.
Thanks for your time!
When facing a problem like yours it's good to remember the basic rule of Excel, "Never put data into a formula". Data belong in a worksheet. Formulas merely manipulate them. Accordingly, you need a table like this one.
Now the solution is easy - or it would be if your description was unambiguous. I presumed that what you call "price reduction" is in fact a tax free portion of the sale. So, if the value of the sale is $200 tax will be paid on an amount smaller than this. Of course, this leads to the possibility of a negative tax which is unlikely to be on offer. Therefore the formula to be employed is [Tax base] = [Sale Amount] - [Tax excempted amount], but not less than zero.
Based on the above presumption the formula below will do the job if you named the table pictured above as "Taxes". If you didn't name it, the default name might be Table1 and you can change that name in the formula.
=G2+MAX(ROUND((G2-VLOOKUP(B2,Taxes,3,FALSE))*VLOOKUP(B2,Taxes,2,FALSE),2),0)
I point out that the formula also rounds the result. This is important in a sheet like yours because you can't afford the total in column H to be different from what you see, and all you see is 2 digits.
Whenever the taxes change you simply change the table and leave the formulas in place. That part is easy. But there is one thing to remember. All the formulas of the past also refer to the table and all your old sales amounts will get "updated". So, when rates change, first Copy/PasteSpecial>Values all existing, or create a new table called Taxes2020 and start using a new formula referring to that table from the cut-off date forward.
If the price deduction if from the total for the region you should calculate it in two stages, the sum for the region, and then the net after tax.
If the deduction is per transaction I would suggest adding a lookup table and add another column to your list which will allow you to calculate all regions with the same formula.
=IF(B2="East",(G2*1.15)-50, IF(b2="Central",(G2*1.18)-40,(G2*1.18)-30))

How to calculate relative average cost by department in excel?

So I am trying to calculate the average cost of On-Hand goods in this example. The goal of this would be to determine the overall cost of goods by department. This would be achieved arithmetically by taking the average cost of the good and multiplying it by the number of goods on hand for that item, and then repeating for each item. I would then want to add items from the same numerical departments to get a department item cost. Is there a way to do this within a single function in excel? So far I have:
=IF($B$2:$B$17=F2,SUMPRODUCT($C$2:$C$17,$D$2:$D$17),"null")
but it is returning an invalid output.
For Cell J2, the output I would want to look for is: $74093.80
The reason I want to do this by function is because I have a spreadsheet with over 76,000 items and 19 different departments on it and need to calculate the Average Inventory Cost of each Department.
Thank you in advance!
Click here for Excel sheet
Put the test inside the SUMPRODUCT():
=SUMPRODUCT(--(B$2:$B$17=F2),$C$2:$C$17,$D$2:$D$17)

Resources