posting sales code help

zendog1960

Active Member
Joined
Sep 27, 2003
Messages
459
Office Version
  1. 2019
Platform
  1. Windows
I have a sheet, "Item Sales" which I would like to used to adjust my "Inventory Data" sheet.

Here are the current layouts:

"Item Sales" only has 3 columns;
Column A = "Item Code"
Column B = "Item Description"
Column C = "Quantity"

"Inventory Data" has many more columns but only the the first three are relevant to this problem.

Column A = "Item Code"
Column B = "Item Description"
Column C = "On Hand"

What I want but cannot figure out is how to do the following:
When I am in the Item Sale sheet and run the 'Post_Sales' macro, it looks at all the occupied rows then by using the 'Item Code', it matches up then takes the "Quantity" and subtracts it from the "On Hand" value in the "Inventory Data" sheet

So if Item Code 123XYZ show that there are 100 "On Hand" and I sell 25 of them. I mark the sale down in the "Item Sales" sheet. When I press the "Post" button, the new value in the Inventory Data sheet for the Item 123XYZ should now be 75.

I am at a loss on how to make this happen though. Any and all help would greatly be appreciated!
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Here is some sample data:

This is the Item Sales Sheet:
Excel Workbook
ABC
1Item CodeItem DescriptionQuantity
20001Item A6
30005Item E10
40006Item F32
Item Sales
Excel 2007

Here is the Inventory Data Sheet:
Excel Workbook
ABC
1Item CodeItem DescriptionOn Hand Quantity
20001Item A25
30002Item B36
40003Item C125
50004Item D20
60005Item E61
70006Item F72
80007Item G250
90008Item H50
100009Item I3
110010Item J72
Inventory Data
Excel 2007

So with this data, when I run the code I am needing help with, the items sold, for example Item A sold 6, the inventory on hand value would change to 19. And it would go through the entire Item Sales List and change the on hand values.

I could really use some help here.
 
Upvote 0
My suggestion is to use the first blank column in INVENTORY DATA file and with an =IFERROR(VLOOKUP... formula, lookup each item on this file against the ITEM SALES file.

When found in Item Sales file the sales quantity will be returned, if there is no match i.e. an error has occurred, you should return the value already on the INVENTORY DATA file.

Copy down the formula. With that column highlighted copy and paste values. Copy the whole column of values and paste over the original values.

This is the manual process, a simple macro could follow those steps.

Hope that helps.
 
Upvote 0

Forum statistics

Threads
1,224,598
Messages
6,179,818
Members
452,946
Latest member
JoseDavid

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