Inventory tracking - vlookup with subtraction from running total - excel-formula

I hope I can explain this clearly enough to get a little help. I've tried looking for an answer by haven't found anything that quite works.
The Problem:
We receive orders from our customers that have the same SKU on multiple PO's (purchase orders). We need to move the inventory from its current location to the DOCK from 4 other locations. The inventory does not go directly to the DOCK. It usually has to pass through 2 or more locations to get processed. so for example SKU0001 starts in LOC2, moves to LOC3 and then gets moved to the DOCK.
What I need:
I have 3 different orders (PO's) that need SKU0001:
PO9999 need 25 units of SKU0001
PO8888 need 10 units of SKU0001
PO7777 need 50 units of SKU0001
I have a grand total of 100 units of SKU0001 in stock, plenty to fulfill the order. The location of the inventory is as follows:
30 units of SKU0001 in LOC1
10 units of SKU0001 in LOC2
20 units of SKU0001 in LOC3
15 units of SKU0001 in LOC4
25 units of SKU0001 in DOCK
I need to be able to determine how many units of SKU0001 have been moved to the DOCK, how many units are in either LOC1, LOC2, LOC3 and LOC4 and how many units are missing to fulfill the order. As I mentioned SKU0001 will appear on the orders tab multiple times as it will be on multiple PO's, so I also need to be able to subtract the number that have been moved to the DOCK from the running total so the next instance of SKU0001 on the list has an accurate location count for the 5 locations listed above.
Right now we are having to manually enter the numbers based on the locations of the inventory, with a few SKU it's not a problem, bu we usually have about 500 SKU and with multiple updates required through the day, it can be very time consuming to update the data.
As I cannot attach any file or add links I will have to give you a break down of the file I am working with,
First Tab: Orders (9 Columns) This is where the formula needs to be added to columns LOC1 thru DOCK.
PO | SKU | QTY_REQ | LOC1 | LOC2 | LOC3| LOC4 | DOCK | MISSING |
Second Tab: Inventory Qty and Locations (7 Columns)
SKU | LOC1 | LOC2 | LOC3 | LOC4| DOCK| TOTAL_INVENTORY |
Any help would be greatly appreciated.

Related

Calculate weighted mean with different types of rows

I want to track the weighted mean price per coin of my crypto currencies in excel.
But I don't know what would be the best approach for my table which looks like this:
| Type | Total Price | Price Per Coin | Coins |
|------|-------------|----------------|-----------|
| Buy | 250 | 7.80 | 32,051282 |
| Buy | 300 | 7.42 | 40,431266 |
| Sell | 270 | 7.61 | 35,479632 |
To calculate the weighted mean one would use the formula:
SUMPRODUCT([Price Per Coin], [Coins])/SUM([Coins])
But in my case the table also holds Sell rows which that I don't want in the calculation of the weighted mean for the Buy price of my coins. How can I exclude them from the formula?
I tried something like:
SUMPRODUCT([Price Per Coin], [Coins])/SUMIF([Type], "==Buy", [Coins])
But this doesn't some to be right (I got a result way over 15 bucks per coin which doesn't make sense...).
How could I furthermore calculate how much I've made/lost with my transactions?
If you have O365:
=LET(x,FILTER(coinTbl,coinTbl[Type]="Buy"),SUMPRODUCT(INDEX(x,0,3),INDEX(x,0,4))/SUM(INDEX(x,0,4)))
=> 7.588
If you don't have O365, this should work:
=SUMPRODUCT(coinTbl[Price Per Coin]*(coinTbl[Type]="Buy"),coinTbl[Coins]*(coinTbl[Type]="Buy"))/SUMIF(coinTbl[Type],"Buy",coinTbl[Coins])
Your second question probably deserves to be separate and include a discussion of what you mean and how you want to calculate your profit/loss Recognized, unrecognized, FIFO, average cost, or some other method.
And also why you are, apparently, using different decimal indicators in your price and coins columns.
A pivot table would let you filter away SELL rows and instantly calculate the sum of total_price, sum of coins
To get proper weighted average you can either refer to the pivot table totals or follow this guide (i just googled for excel weighted average pivot table)
https://www.extendoffice.com/documents/excel/4816-excel-pivot-table-weighted-average.html
Although I am curious because using the data you provided it looks like remaining balance of coins is only 37 not 72
Seems to me you need to at least add more columns to store Coin_balance to track remaining unsold coins for each Buy row

Returning a value based on multiple criteria and ranges of numbers

I am looking for a way to do some type of lookup/match to come up
with bonuses. It is based on what they sold, for how much, and based on how much they sold last year, and the amount increased.
Example Line 2: So say they sold $900 worth of pens to Joe (New Amount is w/in 1-999). Last
year Joe only bought $23 worth of pens (Previous Amount is w/in 1-24) they get a $25 bonus (Bonus). Also..
There also has to be a minimum increase amount (Min increase column). So say if Joe bought
$999 worth of pens last year and $1000 worth of pens this year, the
salesperson shouldn't get a bonus because it was only a buck increase. It has to be at least $50 increase in this case. That's what the Min Increase column is.
Group Min Increase Previous Amount New Amount Bonus
Min Max Min Max
Pens 50 1 24 1000 999999 45
Pens 50 1 24 1 999 25
Pens 50 25 100 1000 999999 45
Pens 5 25 100 1 999 25
Paper 10 1 24 1000 999999 50
Paper 10 1 24 1 999 25
Paper 10 25 100 1000 999999 50
Paper 5 25 100 1 999 25
I started looking at Indexmatching but it's not enough. Then I thought of summing, but it's really not adding anything together.
=SUMIFS(B3:B10, G1:G10, "Pens", D3:D10, "50")
Also, =INDEX(range2,MATCH(TRUE,COUNTIF(range1,range2)>0,0)) won't work because that's only two ranges.
It also has to be something they can update constantly.
The actual data looks something like this
Sale Prev. Group
900 23 Pens
So you'd need to find the difference, see if it's within the minimum increase for the group and the amounts (900-23 > 50). Then return a value. 23 is between 1 and 24 and 900 is between 1 and 999 so $25 bonus.
Does anyone have any suggestions? I'm looking into index matching, but I can't find out how to do it with ranges.
Thanks
The formula is based on aggregate which performs array like operations. As such keep full column references inside of the aggregate function as short as you can and avoid full column references. Based on the layout of information in the picture above, place the following formula in L3 and copy down as required.
=IFERROR(INDEX(G:G,AGGREGATE(15,6,ROW($A$3:$A$10)/(($A$3:$A$10=$K3)*($C$3:$C$10<=$J3)*($D$3:$D$10>=$J3)*($E$3:$E$10<=$I3)*($F$3:$F$10>=$I3)*((I3-J3)>=$B$3:$B$10)),1)),"No Bonus")
Caveat: If for some reason, the sales situation matches multiple rows in your table, then it will return the bonus corresponding to the lowest row number that met all the criteria.

Excel lookup value for multiple criteria and multiple columns

I am helping a friend with some data analysis in Excel.
Here's how our data looks like:
Car producer | Classification | Prices from 9 different vendors in 9 columns
AUDI | C | 100 200 300 400 500 600 700 800 900
AUDI | C | 100 900 800 200 700 300 600 400 500
AUDI | B | .. ..
Now, for each classification and each producer, we produced a list that shows which of the 9 vendors has offers the most lowest prices (in terms of count, so for example there are 2 cars from AUDI in the C class, so vendor A would offer the lowest price for both).
What we need: A way to calculate the average price for this vendor. So, if we see that the vendor A has the lowest price for AUDI cars in the C class, then we want to know the average price for vendor A for these cars.
I'm quite stumped since I can't use the "standard" index-match-small approach since the prices are stored in 9 different columns.
I've suggested to use a long if-chain like this: =if(vendor=A,averageif(enter the criteria and select the column of vendor A for average values),if(vendor=B,average(enter the criteria and select the column of vendor B for average values),... etc.).
But this method is obviously limited and does not scale well to higher dimensions.
We also would like to avoid using any addons.
You're going to need to create a separate table that has all unique classifications in the rows and all dealers in the columns (same as yours, but with duplicate rows removed). Then, in each cell, take the average price for that classification*vendor combination. This can be done by using a combination of sumif/countif. For example, if your second table had a column for classifications in cells M2:M[end], calculating the average price for the Audi C class offered by vendor 1 could be:
=sumif(C$2:C$[end],"="&$M2,$B$2:$B$[end])/countif($B$2:$B$[end],"="&$M2)
This would look something like this:
Then you could simply find the cheapest vendor by matching the min price. For example, the cheapest vendor for the audi C class in my example image would be:
=index($N$1:$V$1,match(min($N2:$V2),$N2:$V2,0))
A lot this could be done using PivotTables. If it is a one off thing, I would go that route, if it needs to be automated, then try using a multicondtional VLOOKUP (needs to be entered as a Matrix Formula: CTRL+ALT+SHIFT). This is simply an example, not based on your data:
{=VLOOKUP(A11&B11,CHOOSE({1\2},A2:A7&B2:B7,C2:C7),2,0)}
A better explanation is given here at chandoos site:http://chandoo.org/wp/2014/10/28/multi-condition-vlookup/

Custom Formula for Grand Total column

I have a frequent problem where the formula I want to use in the Values area in my Pivot-Table is different than the formula I want to use for the Grand Total column of that row. I typically want to Sum the Values but I want to average the Sums. Here is what I normally would get if I pivoted the dates on the Column Labels, Meat Type on the Row Labels, and Sum Orders in the Values.
Row Lables | Day 1 | Day 2 | Day 3 | Grand Total
________________________________________________
Beef | 100 | 105 | 102 | 307
Chicken | 200 | 201 | 202 | 603
I get sums by day and a sum of all of the days in the Grand Total column. Here is what I want to have:
Row Lables | Day 1 | Day 2 | Day 3 | Grand Total (Avg of Day Totals)
________________________________________________
Beef | 100 | 105 | 102 | 102.3
Chicken | 200 | 201 | 202 | 201.0
In this case the Orders are still summed by day but the Grand Total is now an average of the sums. What I do now is copy and paste the Pivot data onto a seperate sheet then calculate the averages. If there was a way to do this with a custom Grand Total column it would be incredible. This is one of the biggest shortcomings of Pivot Tables for me but I'm hoping it is due to my ignorance, which it often is. Thanks for the help!
You can write a measure that checks the number of 'rows' in a particular filter context and nest that in an IF() to determine which to use.
If using PowerPivot V2 then it's:
=IF(HASONEVALUE(Calendar[Day]), SUM(AMOUNT), AVERAGE(AMOUNT))
If using PowerPivot V1 it's:
=IF(COUNTROWS(Calendar[Day])=1, SUM(AMOUNT), AVERAGE(AMOUNT))
Both do the same thing in that they assess the number of rows in the table in the given context and when the Meat Type is 'Beef' then the temporarily filtered table has one row. If it doesn't have one row then its going down the path of the AVERAGE()
This assumes your column headers 'Days' are in a table called Calendar (if you aren't using a separate Calendar table then you are missing the most powerful functionality of PowerPivot IMO).
Jacob
I can't think of a "good" way, but here's one option. Add the Amount field to the data area a second time and change the operation to Average. Then use conditional formatting to hide the averages in the data area and hide the sums in the total area.
You might be better off just using some array formulas in a do-it-yourelf pivot table. You lose the pivot table benefits, but get more flexibility with the data.

How can I show the total for a purchase order?

I have a spreadsheet that is updated with different purchase orders in it.
I basically need to show the to show the total for each individual purchase order.
For example I have order 10,11,12 etc with different amounts entered.
The only problem is that the orders come in different orders.
I need a formula that will total the different purchase orders even tho they come in a random order.
They are all in the same column however, as well as the price.
Thanks in advance.
Leigh
You can use SUMIF
A B C D
1 OrderNo Price OrderNo OrderTotal
2 10 25 10 =SUMIF($A$2:$A$10,"=" & C2, $B$2:$B$10) // =175
3 12 100 11 =SUMIF($A$2:$A$10,"=" & C3, $B$2:$B$10) // =100
4 10 50 12 =SUMIF($A$2:$A$10,"=" & C4, $B$2:$B$10) // =200
5 11 10
6 10 50
7 12 100
8 11 75
9 11 15
10 10 50
You should consider a pivot table. Put the Order No in the Row field and Sum of Price in the data field.
Hm. Are we talking about the parts of a purchase order being separated from one another in the spreadsheet? I'm not sure I understand the question...
If you have an order ID or other unique field, you might be able to use VLOOKUP (but only if there's just row for each order). You might also be able to sort by order number and use SUM.

Resources