Automatically Reduce Stock from selling list

meriambambu

New Member
Joined
Jun 15, 2016
Messages
17
I would like to create a file that can reduce stock automatically from my starting inventory based on the name of item that was sold.

here is a download link for my sample file
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
inventory
apples375
oranges510
pears230
before sale of pears
inventory
apples375
oranges510
pears240
sales
pears10done
this macro checks all sales
and if not marked done
updates inventory
and marks that sale "done"
For j = 20 To 100
If Cells(j, 1) = "" Then GoTo 100
If Cells(j, 3) <> "" Then GoTo 50
For k = 3 To 5
If Cells(k, 1) <> Cells(j, 1) Then GoTo 20
Cells(k, 2) = Cells(k, 2) - Cells(j, 2): Cells(j, 3) = "done": GoTo 50
20 Next k
50 Next j
100 End Sub

<colgroup><col width="64" span="12" style="width:48pt"> </colgroup><tbody>
</tbody>
 
Upvote 0
a macro just does a few calculations and changes the contents of specified cells. This one uses 2 loops to move through your data. Say A1 is the number of apples = 100. You sell 15 apples - how do you propose to change A1 from 100 to 85 ? It CAN be done but it is not more simple.
 
Upvote 0
pears3initial stock100apples100 is in cell H1
lemons7
apples2
oranges4current stock78apples
pears3
lemons7
apples2
oranges4
pears7
lemons2
apples4formula giving 78
oranges2
pears4=$H$1-SUMPRODUCT(($A$1:$A$100=$I$1)*($B$1:$B$100))
lemons3
apples7
oranges2
pears4I set the limit to A100 so you can add sales in the future
lemons3
apples7easy to add new purchases of apples to the formula
oranges5

<colgroup><col span="14"></colgroup><tbody>
</tbody>
 
Upvote 0
Hello again oldbrewer,

I am having difficulty with the formula.
This is the sample file that i manage now, i have to copy the function 1 by 1 with some modifications.
FYI, stock out always 1 by 1 based on the item name.
 
Upvote 0
The result become like this
=$I$4-SUMPRODUCT(($M$4:$M$100=$H$4)*($N$4:$N$100))
=$I$5-SUMPRODUCT(($M$4:$M$100=$H$5)*($N$4:$N$100))
=$I$6-SUMPRODUCT(($M$4:$M$100=$H$6)*($N$4:$N$100))
=$I$7-SUMPRODUCT(($M$4:$M$100=$H$7)*($N$4:$N$100))=$I$4-SUMPRODUCT(($M$4:$M$100=$H$4)*($N$4:$N$100))=$I$5-SUMPRODUCT(($M$4:$M$100=$H$5)*($N$4:$N$100))
=$I$6-SUMPRODUCT(($M$4:$M$100=$H$6)*($N$4:$N$100))
=$I$7-SUMPRODUCT(($M$4:$M$100=$H$7)*($N$4:$N$100))

This formula cell references were input by me manually.
Can i make it automatically increase by 1 cell reference ?

<colgroup><col></colgroup><tbody>
</tbody>
 
Upvote 0
if you want to increase down from A1 if a1=b1+c1

you do not want a $ before the 1

so you start with $I4 not $i$4
 
Upvote 0

Forum statistics

Threads
1,215,048
Messages
6,122,862
Members
449,097
Latest member
dbomb1414

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