Spread values across rows based on codes - excel

I have two tables (1.Purchase order and 2.The invoice) and I want to spread the quantity from the invoice table to the purchase order invoice quantity column by code but I want to match the exact quantity from the purchase order quantity.
Here is how the table looks now:
Purchase order table and Invoice table
And this is how i want it to look:
In this post a formula was suggested
=MAX(MIN(M$2-SUM(E$1:E1), D2), 0)
which I customized to use vlookup so it can match the code,
=MAX(MIN(VLOOKUP(A2,J:M,4,FALSE)-SUM(E$1:E1), D2), 0)
but that doesn't work.
#Jeeped suggested to use AGGREGATE function for a one column conditional match, but can anyone give me an example related to this situation?
Here is the sample Excel file
Thank you!

In E2 as,
=MAX(MIN(VLOOKUP(A2, J:N, 4, FALSE)-SUMIFS(E$1:E1, A$1:A1, A2), D2), 0)
What happened to row 1?

Related

How to identiy new/repeat customers

I have a list of ~55k customer sales. I need to create a column to identify if a sale was repeat or new business based on customer name. I have columns A/B and I want to create column C as shown below:
Alternatively:
=IF(COUNTIF(B$2:B2,B2)>1,"Repeat","New")
This assumes that Column A is sorted ascending:
Put this in C2 and copy down:
=IF(ISNUMBER(MATCH(B2,$B$1:B1,)),"Repeat", "New")
If the data is not sorted we need to switch to COUNTIFS(), which is not as optimized as MATCH and will cause issues in the calc if the data set it too large(>10,000)
=IF(COUNTIFS($A:$A,"<"&A2,$B:$B,B2),Repeat", "New")
Again put that in C2 and copy down the dataset.
MINIFS Beats COUNTIFS?
If there is only one first date associated with each customer then the data has not to be sorted and you can use the following:
=IF(A2>MINIFS($A:$A,$B:$B,B2),"Repeat","New")

Index Match With Multiple Criteria to find cell before (Excel)

I am looking to do a match index with a double criteria > but i want to return the results of the cell above the results.
e.g.
Two tables
Table A is the reference point and i want to reference the Invoice Number and Product Description from Table A - find them in Table B, but i want to return the Invoice number in the above cell from table B.
if i used Invoice number 987600/Product 1 from table A as an example.
The look up would find Invoice Number 9876008, find Product 1, then return invoice numerb 608034 (As it is the one above 9876008) in table B
Thank you in advance
Use AGGREGATE:
INDEX(TABLE2!C:C,AGGREGATE(15,7,(ROW(TABLE2!$C$2:$C$100)-1)/((TABLE2!$C$2:$C$100=9876008)*(TABLE2!$F$2:$F$100="Product 1")),1))

Return Value if 4 columns match in Excel

I have 2 sheets that I am working with in Excel:
1) Master Price Sheet
2) Entry
My "Master Price Sheet" sheet includes specific lumber dimensions and specifications as well as an assigned pricing (There are probably 200 different options available for pricing purposes so it takes a long time to manually look up each price)
When I am entering lumber lists into my "Entry" sheet. . .I'd like to return the value from the column "Price" from the "Master Price Sheet" only if the values in columns "Size (W)", "Size (H)", "Length", and "Species" entered into the "Entry" sheet matches columns in the "Master Price Sheet" so that it can find the pricing for me
What formula would be able to help me out with this?
Any help you can provide would be greatly appreciated
I've added images to this post below so that you can see what I'm working with
The easiest way is probably to create a helper column in both tables, where you combine the four cells with an ampersand & sign. This will create a unique key that you can use in a lookup function like VLoookup or an Index/Match combination.
For example: in the Master table, insert a new column before the price and in that new column use the formula (starting in cell G3
=A3&C3&D3&E3
Do the same in the Entry sheet table. Then you can look up the price like this in cell H3 of the entry table:
=vlookup(G3,'Master Price Sheet'!F:G,2,False)
Copy down.
This is the basic principle. You can add more refinement by error catching, so you don't get errors if rows are empty. One of many approaches would be to wrap the formula in an IfError, or check that all four cells have content before performing the Vlookup.

Excel: Unique codes referencing properties of each product on an invoice

I have been generating invoices by manually inputing the information for each product.
What I would like to do is type in a unique product code (E.g., "01-A") and in the same row automatically return the color, size, price, etc. ("properties") of the product.
I have a separate "database" sheet with these data and the product code in the same column.
I have attached a graphical example illustrating this idea.
Thank you very much for your assistance!
You need a lookup - in this case a VLOOKUP.
=VLOOKUP(Value you want to look up, range where you want to lookup the value, the column number in the range containing the return value, Exact Match or Approximate Match – indicated as 0/FALSE or 1/TRUE).
For example:
=VLOOKUP(B5, Sheet2!$C$2:$G$50, 2, FALSE)
Where B5 is the product code you enter, Sheet2!$C$2:$G$50 is the table with the product details on the other sheet, 2 means the second column (i.e. size), and FALSE to say only lookup if there is a match.
See the Microsoft reference.
Assuming your Sheet1 is as follows
Then, in Cell B5 of Sheet2 enter the following formula
=IFERROR(VLOOKUP($A5, Sheet1!$A$5:$D$7, COLUMN(B$1)-COLUMN($A$1)+1, FALSE),"")
Drag/Copy this formula down and across (to right) as required. See image for reference.

Get each price per month for a category?

I have data with the entities date, name, price. I managed to get distinct categories in the Categories colume for each name with = LEFT(B2;FIND(" ";B2)). In fact I want to get for each categorie the summed up monthly prices per month.
My sheet:
I tried:
=SUMIF(B2:B6;LEFT(B2;FIND(" ";B2));C2:C6)
However, this formula returns 0 and also does not give me the prices per categorie and per month.
I really appreciate your help!!!
If you want a sum on each row which will sum for the category of the current row and the month of the current row you can use SUMIFS like this
=SUMIFS(C:C;E:E;E2;A:A;">"&EOMONTH(A2;-1);A:A;"<="&EOMONTH(A2;0))
SUMIFS requires Excel 2007 or later
=SUMIF(E:E,E2,C:C) will sum the categories for you
I think if you want to sum categories by date, you might want to use a Pivot Table or write a Macro
You can write a =sumif function with multiple criteria but I'm not sure how you would define the "date rage" for each new criteria

Resources