How do I decrement quantity by line in Excel? - excel

New user on Stack Overflow, apologies for my lack of Excel knowledge.
Essentially I have a spreadsheet with all of our customer orders including order number, item SKU, and quantity sold on that order (see pic for example). To estimate profit margin on each of the lines, I'm trying to assign a vendor cost to the orders for each of the vendors.
For example, if we ordered 150 of SKU ABC1 from Vendor1 and 200 of SKU AB1 from Vendor2, I want to assign the cost of Vendor1 to as many orders of that SKU that equal 150, then finish with cost from Vendor 2 for the rest. This will give us an estimate of how much margin we're making by vendor.

Is each order specific to a Vendor? For example, Order 1 is for Vendor 1, Order 2 is for Vendor 3, etc.
If so, you could add the vendor to each order and then use a VLOOKUP to lookup the cost of the SKU for the given vendor. Then it should just be COST * QTY.
Also new here; otherwise, I would have just left a comment.

Related

How can I add weighted calculations to a pivot table?

I have a set of sales figures that came from New Business and Upsells that I am trying to cross reference with the cost of sales effort. I am trying to add weights to the values to reflect that we consider one type of sale to require more effort, and then to calculate how much effort we really spent on each item.
Here's an example, assuming Product 1 sales effort of 600 and Product 2 sales effort of 200
Now in a simple calculation it's easy to determine how much sales effort went into each line, and therefore how much sales effort we would need to replicate these results:
Product
Type of sale
Value of sale
Sales Effort
Product 1
New business
100
100
Product 1
Upsell
500
500
Product 2
New business
500
200
But we consider that new business requires 10x the sales effort compared to upsells, so I need to incorporate that. Here's how that should end up looking:
Product
Type of sale
Value of sale
Weighted value of sale
Weighted sales effort
Product 1
New business
100
1000
400
Product 1
Upsell
500
500
200
Product 2
New business
500
5000
200
So far the best way I found of doing it was the following formula, for example for E2, then changing the value of the sales effort:
E2 = (total sales effort for that product) * D2 / (SUMIFS(D2:D4,A2:A4,A2))
I think the (sales effort for that product) could be replaced with an IFS statement to automatically pick that value given A-column value, but am I missing something? Is there a better way of doing this if I want to include it in a Pivot table with some easy to use slicers?

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.

Multiple conditions for a cell value in Microsoft Excel

I'm an insurance broker and currently I'm using Microsoft Excel to organize my insurance commissions. There are multiple insurance companies I'm cooperating with, like {Asia, Iran, Dey} and each of them offers a variety of insurance policies which I have selected a few to simplify the question: {Liability, Life, Third Party, Health}. Each company calculates commissions differently, as an example Dey would calculate commissions related to Liability policies with 30 Percents.
What I want to do is an excel document which the first column is the Premium which I type in for every policy; Imagine $200 for a Life insurance sold by Asia. The second column will be the insurance companies name - selected from a dropdown list -, in this case Asia. Next Column should be another dropdown list with policies that in this example I should choose life. at this point I want an automated process which understands that this was a life insurance policy by Asia, so the commission should be calculated with 8 percents and print this into the next column. and automatically multiply the premium and commission percentage ($200 * 8% = $16) and output this number to the last column.
I have prepared a schematic image of what information I have :
Schematic design of my information
I used to do this with extremely nested if and and with 2 insurance companies but when the third one was added I ran out of options.
In the following example, the lookup table (G1:I13) retrieves the commission percentage. This is used to calculate the actual commission from the policy cost.
=INDEX(I:I, AGGREGATE(15, 6, ROW($2:$99)/(($G$2:$G$99=$B2)*($H$2:$H$9=$C2)), 1))

Generic Inquiry of discount Percent or Prices

What is the best way to export a list of the current discounts: percent, (price - if possible) and inventory id(s). We currently utilize 2 types of discounts:
Customer Price Class by item - Line - Percent and Quantity
Customer Price Class by item - Group - Percent and Quantity
To give some back story. We produce print catalogs. We would like to know the discounted price. It is helpful to know that the price we are displaying is correct. If finding the price is too complicated. The percent for the given quantity break would be enough (we have max of 3 break quantities). Entering these into a sales order or a quote is an option but we have 980 discount sequence ids.
Discount Codes
Thank you.
I have a GI that I believe will do that or get you close enough to finish...See if this result looks good for you
if so add these tables
[Add these relations]
relations
enter image description here
enter image description here
I hope this will help you...

finding the closest match based on multiple criteria

Ive been working on VBA at work for almost a year and have managed to pull of some rather impressive things, normally I can find anything I'm not sure about with a series of searches on this site or others but this time I have come up blank, I guess its most likely because I don't really know how to frame the search properly :(
I'm looking to create a macro that analyses a customers sales history, then preforms a 'you might also like' search from our bestsellers list and returns the closest match to their bestseller. The product is books and due to many decades of bibliographic attention to detail within the industry each product can have up to 20 categories and I want to use this to find the closet match.
The info I have (the important bits)
Sheet 1 - product id - customer sales quantity
Product id 2 -customer sales quantity
Product id 3 -customer sales quantity
Etc etc ( usually up to 100)
Sheet 2 - product id - total company sales quantity
product id2 - total company sales quantity product id3 - total company sales quantity
Etc etc (Currently over 34000 and growing...)
Sheet 3 - cat1 cat2 cat3 cat4 cat5 cat6 etc (to cat400)
Product id 1 0 1 1 0 0
Product id2 0 1 1 0 1 0
Product id3 1 0 1 1 0 0
What I want to be able to is to find the bestseller from the customers list, look up all of the matching categories for that product on the cat reference table, find all results with an exact match to those categories and list them by total company's sales value. Although it is very possible that with the amount of possible categories there will not be an exact mach so I would like then to get the closest match of that product.....
Does that make sense? Please let me know if any more info is needed to help - even just a pointer towards some kind of function or a snippet of code that will help me on my way would be appreciated, I just have no idea how to find a match for an entire rows values.... and even less of an idea of how to find a closest match if there are no exacts...
Interesting question. There's no match function to achieve what you want. Instead, you need to first figure out what kind of algorithm/logic you want to use in order to determine the closest books. This will require a lot of weighing. Here's how I'd do it (without VBA):
Let's use the following data as example:
Approach:
Combine product info with overall sales info, to have a weight for each book:
Determine to the "average preference" of the customers basket in sheet1. In order to do so:
Add the category information for the 400 categories to each product in the basket:
Sum each category for all basket products (see row 6 above)
Determine the weigh (see row 7).
Apply this preference to all products to determine the overall fit:
Compare each product's categories with the preference:
Check that the product is not already in the basket:
Combine all three factor to determine each product's fit (by multiplying the factors) - and rank them using the RANK function:
Last but not least, retrieve the top X highest matches with a lookup:
Here's the sample file.

Resources