Auto update price

KratZ88

New Member
Joined
Dec 31, 2020
Messages
3
Office Version
  1. 2019
Platform
  1. Windows
Hi,

I am looking for a solution to auto update price for an item to newer price when the old price stock is finished.

Example:
I bought apples twice,
5 apples for $1 each
6 apples for $2 each

And when I sold the first batch out, I want the base price to auto update to new price reflecting the second batch price. Is there any way to do it?

Thanks.
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Try this:
Test_Input_Output.xlsm
ABCDEFG
1
2No. of SoldPriceNo. Of AppleBuying or Solding Price
311.251.2
422.462.3
511.2
623.5
712.3
8
Sheet1
Cell Formulas
RangeFormula
B3B3=IF(SUM($A$3:A3)<=$E$3,A3*$F$3,IF(SUM($A2:A$3)<$E$3,(SUM($A$3:A3)-$E$3)*$F$4+($E$3-SUM($A2:A$3))*$F$3,A3*$F$4))
B4:B7B4=IF(SUM($A$3:A4)<=$E$3,A4*$F$3,IF(SUM($A$3:A3)<$E$3,(SUM($A$3:A4)-$E$3)*$F$4+($E$3-SUM($A$3:A3))*$F$3,A4*$F$4))
 
Upvote 0
With more than 2 price Use column C formula:
Test_Input_Output.xlsm
ABCDEFGH
1
2No. of SoldPriceIndex PriceSum of NumberNo. Of AppleBuying or Solding Price
311.21.2551.2
422.42.41162.3
511.21.21872.5
623.53.52683.2
712.32.33593.5
836.9
937.3
1025
Sheet1
Cell Formulas
RangeFormula
B3B3=IF(SUM($A$3:A3)<=INDEX($E$3:$E$7,IFERROR(MATCH(SUM($A$3:A3),$E$3:$E$7,1),0)+1),A3*INDEX($E$3:$G$7,IFERROR(MATCH(SUM($A$3:A3),$E$3:$E$7,1),0)+1,3),IF(SUM($A2:A$3)<INDEX($E$3:$E$7,IFERROR(MATCH(SUM($A$3:A3),$E$3:$E$7,1),0)+1),(SUM($A$3:A3)-INDEX($E$3:$E$7,IFERROR(MATCH(SUM($A$3:A3),$E$3:$E$7,1),0)+1))*INDEX($E$3:$G$7,IFERROR(MATCH(SUM($A$3:A3),$E$3:$E$7,1),0)+2,3)+(INDEX($E$3:$E$7,IFERROR(MATCH(SUM($A$3:A3),$E$3:$E$7,1),0)+1)-SUM($A2:A$3))*INDEX($E$3:$G$7,IFERROR(MATCH(SUM($A$3:A3),$E$3:$E$7,1),0)+1,3),A3*INDEX($E$3:$G$7,IFERROR(MATCH(SUM($A$3:A3),$E$3:$E$7,1),0)+2,3)))
B4:B7B4=IF(SUM($A$3:A4)<=$F$3,A4*$G$3,IF(SUM($A$3:A3)<$F$3,(SUM($A$3:A4)-$F$3)*$G$4+($F$3-SUM($A$3:A3))*$G$3,A4*$G$4))
E3:E7E3=SUM($F$3:F3)
C3C3=IF(SUM($A$3:A3)<=INDEX($E$3:$E$7,IFERROR(MATCH(SUM($A$3:A3),$E$3:$E$7,1),1)),A3*INDEX($E$3:$G$7,IFERROR(MATCH(SUM($A$3:A3),$E$3:$E$7,1),1),3),IF(SUM($A2:A$3)<INDEX($E$3:$E$7,IFERROR(MATCH(SUM($A$3:A3),$E$3:$E$7,1),1)),(SUM($A$3:A3)-INDEX($E$3:$E$7,IFERROR(MATCH(SUM($A$3:A3),$E$3:$E$7,1),1)))*INDEX($E$3:$G$7,IFERROR(MATCH(SUM($A$3:A3),$E$3:$E$7,1),1)+1,3)+(INDEX($E$3:$E$7,IFERROR(MATCH(SUM($A$3:A3),$E$3:$E$7,1),1))-SUM($A2:A$3))*INDEX($E$3:$G$7,IFERROR(MATCH(SUM($A$3:A3),$E$3:$E$7,1),1),3),A3*INDEX($E$3:$G$7,IFERROR(MATCH(SUM($A$3:A3),$E$3:$E$7,1),1)+1,3)))
C4:C10C4=IF(SUM($A$3:A4)<=INDEX($E$3:$E$7,IFERROR(MATCH(SUM($A$3:A4),$E$3:$E$7,1),1)),A4*INDEX($E$3:$G$7,IFERROR(MATCH(SUM($A$3:A4),$E$3:$E$7,1),1),3),IF(SUM($A$3:A3)<INDEX($E$3:$E$7,IFERROR(MATCH(SUM($A$3:A4),$E$3:$E$7,1),1)),(SUM($A$3:A4)-INDEX($E$3:$E$7,IFERROR(MATCH(SUM($A$3:A4),$E$3:$E$7,1),1)))*INDEX($E$3:$G$7,IFERROR(MATCH(SUM($A$3:A4),$E$3:$E$7,1),1)+1,3)+(INDEX($E$3:$E$7,IFERROR(MATCH(SUM($A$3:A4),$E$3:$E$7,1),1))-SUM($A$3:A3))*INDEX($E$3:$G$7,IFERROR(MATCH(SUM($A$3:A4),$E$3:$E$7,1),1),3),A4*INDEX($E$3:$G$7,IFERROR(MATCH(SUM($A$3:A4),$E$3:$E$7,1),1)+1,3)))
 
Upvote 0
Solution
Hi maabadi,

Thank you very much for your solution. Maybe I was not being clear enough in my problem, I am sorry.
I am currently handling quite many inventory ins and outs, so I don't think hard codding the formula like this is efficient in my case.
But you do give me a hint on how to tackle this problem.
Once I have found my solution, I will be sure to post my solution here.

Until then, I will still be checking this thread. So any solutions, any hints are very much welcome.
Thanks a lot.
 
Upvote 0
Hi maabadi,

I have found the logic to my question. I will be incorporating this logic to my excel.

FIFO-Inventory-Data-tables.xlsx
ABCDEFGHIJKLM
1INOUT8
2
3DateUnitsPrice/unitTotalUnit OUTBase PriceUnits leftValueMIN(B4,sales-SUM($F$3:F3))
431-Dec610606600-MIN(6,8-SUM(0))
501-Jan520100240360MIN(6,8)
602-Feb213.5270-2276
703-Mar315450-345
804-Apr212.5250-225MIN(B5,sales-SUM($F$3:F4))
905-May111110-111MIN(5,8-SUM(6))
1006-Jun320600-360MIN(5,2)
11Total222
Sheet1
Cell Formulas
RangeFormula
F4:F10F4=MIN(B4,sales-SUM($F$3:F3))
G4:G10G4=F4*C4
H4:H10H4=B4-F4
I4:I10I4=H4*C4
D4:D10D4=B4*C4
B11B11=SUM(B4:B10)
Named Ranges
NameRefers ToCells
sales=Sheet1!$G$1F4:F10

CellsFormula
F4=MIN(B4,sales-SUM($F$3:F3))
F5=MIN(B5,sales-SUM($F$3:F4))
F6=MIN(B6,sales-SUM($F$3:F5))
F7=MIN(B7,sales-SUM($F$3:F6))
F8=MIN(B8,sales-SUM($F$3:F7))
F9=MIN(B9,sales-SUM($F$3:F8))
F10=MIN(B10,sales-SUM($F$3:F9))

Thank you very much and Happy New Year!
 
Upvote 0
Glad you can find your answer and way to slove it. Happy new year & good Luck.
 
Upvote 0
Hi maabadi,

I have found the logic to my question. I will be incorporating this logic to my excel.

FIFO-Inventory-Data-tables.xlsx
ABCDEFGHIJKLM
1INOUT8
2
3DateUnitsPrice/unitTotalUnit OUTBase PriceUnits leftValueMIN(B4,sales-SUM($F$3:F3))
431-Dec610606600-MIN(6,8-SUM(0))
501-Jan520100240360MIN(6,8)
602-Feb213.5270-2276
703-Mar315450-345
804-Apr212.5250-225MIN(B5,sales-SUM($F$3:F4))
905-May111110-111MIN(5,8-SUM(6))
1006-Jun320600-360MIN(5,2)
11Total222
Sheet1
Cell Formulas
RangeFormula
F4:F10F4=MIN(B4,sales-SUM($F$3:F3))
G4:G10G4=F4*C4
H4:H10H4=B4-F4
I4:I10I4=H4*C4
D4:D10D4=B4*C4
B11B11=SUM(B4:B10)
Named Ranges
NameRefers ToCells
sales=Sheet1!$G$1F4:F10

CellsFormula
F4=MIN(B4,sales-SUM($F$3:F3))
F5=MIN(B5,sales-SUM($F$3:F4))
F6=MIN(B6,sales-SUM($F$3:F5))
F7=MIN(B7,sales-SUM($F$3:F6))
F8=MIN(B8,sales-SUM($F$3:F7))
F9=MIN(B9,sales-SUM($F$3:F8))
F10=MIN(B10,sales-SUM($F$3:F9))

Thank you very much and Happy New Year!
Hi,

I am super happy you found the solution with the formula =MIN(B4,sales-SUM($F$3:F3)), but would you be kind enough to explain how does it return the value in the cell F4.

Thank you in Advance.
Regards,
SSD
 
Upvote 0

Forum statistics

Threads
1,214,944
Messages
6,122,387
Members
449,080
Latest member
Armadillos

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