Complex Excel lookup formula

Lets say I run 3 stores plus a Distribution Centre (DC). Whenever a customer orders inventory at each store, I want to update that store's remaining inventory.  Also, if the customer orders more inventory than what the store has in stock, then i want the formula to reduce the inventory from the DC instead.  

Here is my scenarios for this example: (note: I only used 4 customers in this example, but i need the formula to have the ability to deal with several more than this).

Store1 Inventory: 200
Store2 Inventory: 200
Store3 Inventory: 200

Distribution Centre (DC) Inventory: 1000

Action1
Store1_Customer1 buys 150 items, so I need to reduce Store1 inventory down to 50.  Since there is stock remaining at the store, I do not need to draw down stock at the Distribution Center (DC) at this time.

Action2
Store2_Customer2 buys 250 itmes from store2, so I need to reduce Store2 inventory down to 0 items, and reduce the DC inventory down by 50 from 1000 to 950.

Action3:
Store2_Customer3 buys 100 itmes from store2, since there is 0 inventory remaining at Store2 I need to reduce the DC inventory down by 100 items from 950 to 850.

Action4
Store3_Customer4 buys 250 items from store3, so I need to reduce this store's inventory down to 0, and reduce the DC inventory by 50, from 850 to 800.


I attached a screen print of my worksheet to give you an idea of the layout.
Note:  The yellow-highlighted area is where I need the formulas to update the remaining inventories.


Thanks

excel-formula.JPG
jtenchaAsked:
Who is Participating?
 
Nico BontenbalCommented:
See attached file. I've added two 'helper' colums. 'Total needed' and 'From DC'. With these extra columns there is no need for complex formula's.
Inventory.xlsx
0
 
royhsiaoCommented:
Please review the worksheet.
ExcelLookup-Formula.xls
0
 
royhsiaoCommented:
Please review the screen shot. I use sumif to find out the order for each store. I check if the store order is greater than the store inventory. If the store order is greater than the store inventory, the store inventory goes to 0 and DC invenotry will be reduce by the extra order.
ExcelLookup.JPG
0
 
sijpieCommented:
You can do this with some formulas and extra columns. But maybe not efficient whenthat you can expand the sheet with lots of clients and products.

See here result and formulas

http://screencast.com/t/lbv9y4RL

Alternative , itcan be done though is that for every customer added to the list, a macro is run that does the calculation and updates the yellow fields
0
 
jtenchaAuthor Commented:
Thanks for the help.  I think these formulas will work.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.