You can also accomplish without even using code. Insert a new column that contains a unique identifier for the line item (PO-SKU). Something that would make it unique so that you could compare the new vs old. Do this for both new and old data. Then you could simply use the vlookup function against the unique identifier to return the value from the sheet that contains the old data. You can then insert a comparrison column at the end that will return true, false, or the difference, etc. Here is an example:
In this case the Key is the unique identifier for each item. Comparing the ShipQty from this month to last month...The difference is simply the following formula: IF(IF(ISNA(VLOOKUP(A2,$A$9:$F$13,1)),FALSE,TRUE)=T RUE,IF(VLOOKUP(A2,$A$9:$F$13,7)=E2,0,VLOOKUP(A2,$A $9:$F$13,7)-E2))
Column A = Key: 5551177-12333355 (Made up of PO#5551177 & SKU# of 12333355)
Column B= PO#
Column C = SKU#
Column D= OrderQty
Column E= ShipQty
Column F= QtyDue
Column G = Difference
Etc...
This formula simply says is the line item in last month's data? If so, then what was the Ship Qty last month and is it the same as the current month and if not then what is the difference.
Once you place your formula then you can copy and paste values so that excel doesn't keep recalculating when you save and so forth. Keeps it from slowing down.
Hope this helps some.
|