Need formula to find match, then divide bulk pricing to produce total price per piece.

solidENM

Board Regular
Joined
Feb 23, 2017
Messages
93
Hello,
I have a master list that includes crates and individual piece pricing. When this was originally setup, it was all manual. There are thousands of items and pricing changes do occur. I have received updated pricing for crates, but not individual pieces. I need help creating a formula that will take a crate #, get the quantity from the matching cell, and divide the total price by packs and boxes.

Using the table below, yellow crates in row 1 show there are 20 boxes with 5600 pieces each, total price for all that is 4312.25.
Row 4 has an individual yellow part. Column E shows the matching crate number. I need a formula that will use E4, search column a for a match, then take 4312.25 / 20 / 5600, and then fill in the new price in D4. In this case, its 0.038502

Essentially it will take total price, divide by boxes, by pieces, and produce the each price in column D. each crates description is in the same format, with a #x # at the end of each cell. This is the modifier I need to divide the price in column D.


[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]row[/TD]
[TD]Column a[/TD]
[TD]Column C[/TD]
[TD]Column D[/TD]
[TD]Column E[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Part Number[/TD]
[TD]Description[/TD]
[TD]Price[/TD]
[TD]Bulk # (if appl)[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]5698552362[/TD]
[TD]yellow 20X5600[/TD]
[TD]4312.25[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]5698552373[/TD]
[TD]Green 20X6000[/TD]
[TD]1945.25[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]5698552384[/TD]
[TD]red 20X6070[/TD]
[TD]2525.12[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]6574552345[/TD]
[TD]yellow piece[/TD]
[TD] 0.038502[/TD]
[TD]5698552362[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]6574552356[/TD]
[TD]green piece[/TD]
[TD][/TD]
[TD]5698552373[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]6574552367[/TD]
[TD]red piece[/TD]
[TD][/TD]
[TD]5698552384[/TD]
[/TR]
</tbody>[/TABLE]


If i can get this formula working, I will only have to type in the bulk part# equivalent for each "piece line" and future updates will go smoothly.


Thanks for looking, and Im hoping you can help.
 
Last edited:
https://ibb.co/mqksNb

Is this what you are seeing?

Is the formula in row 5? (headers in row 1)

Works now, thanks Mrshl. I had simplified my template to make an easy to read example on here. I pasted the example directly into excel when testing your code, and had the column with Row#s on there.... Thanks for pushing it back and letting me know it works. From here Ill try and modify it so it works in my longer master list.
Thank you for all your help!
 
Upvote 0

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
solidENM,

Just be mindful that the above solution will not give the expected result if your description has any other spaces preceding the one before the **X****. Or if there is a preceding "X" in the description.
 
Last edited:
Upvote 0
Just in case it helps, the below should take care of the issue if preceding spaces are likely to give you a problem. Also it will allow for box and piece quantities to be other than **X****. eg ****X**
Edit the range lower limit from 1000 to a sensible max for your data set.


Excel 2010
ABCDEF
1Part NumberDescriptionPriceBulk # (if appl)Piece prices
256985523625 698 552 362Xtra yellow 20X56004312.25 
356985523735 698 552 373Green 20X60001945.25
456985523845 698 552 384red 20X60702525.12
565745523456 574 552 345Xtra yellow piece56985523620.038502
665745523566 574 552 356green piece56985523730.016210
765745523676 574 552 367red piece56985523840.020800
Sheet3
Cell Formulas
RangeFormula
F2=IFERROR(VLOOKUP(E2,$A$1:$D$1000,4,0)/RIGHT(SUBSTITUTE(TRIM(RIGHT(SUBSTITUTE(VLOOKUP(E2,$A$1:$C$1000,3,0)," ",REPT(" ",99)),20)),"X",REPT(" ",10)),10)/LEFT(SUBSTITUTE(TRIM(RIGHT(SUBSTITUTE(VLOOKUP(E2,$A$1:$C$1000,3,0)," ",REPT(" ",99)),20)),"X",REPT(" ",10)),10)," ")


Hope that helps.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,329
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top