Macro to update cost value of sales transactions between 2 dates

rajdeepkhurana

New Member
Joined
Aug 29, 2017
Messages
1
Hi Experts,
Heres my query and thank you in advance for your help.

TABLE 1
===
I have a list of sales transactions.
[TABLE="width: 500"]
<tbody>[TR]
[TD]Date[/TD]
[TD]Item #[/TD]
[TD]Revenue[/TD]
[TD]Cost[/TD]
[TD]Profit[/TD]
[/TR]
[TR]
[TD]17 feb 2017[/TD]
[TD]568[/TD]
[TD]$100[/TD]
[TD]$70[/TD]
[TD]30[/TD]
[/TR]
[TR]
[TD]18 Feb 2017[/TD]
[TD]439[/TD]
[TD]$120[/TD]
[TD]$130[/TD]
[TD]-10[/TD]
[/TR]
[TR]
[TD]01 Mar 2017[/TD]
[TD]439[/TD]
[TD]$150[/TD]
[TD]$130[/TD]
[TD]20[/TD]
[/TR]
</tbody>[/TABLE]

TABLE 2
===
I have another table that records the costs of each item.
[TABLE="width: 500"]
<tbody>[TR]
[TD]Item #[/TD]
[TD]Shipping Cost[/TD]
[TD]Direct Cost[/TD]
[TD]Total Cost[/TD]
[/TR]
[TR]
[TD]568[/TD]
[TD]20[/TD]
[TD]50[/TD]
[TD]$70[/TD]
[/TR]
[TR]
[TD]439[/TD]
[TD]80[/TD]
[TD]50[/TD]
[TD]$130[/TD]
[/TR]
</tbody>[/TABLE]


I currently use the Index and Match function to fetch the cost of the item # from Table 2


Here's the problem:
Due to changing market, lets say the the cost of procuring item 439 changes. My old profit should not change. How do i fetch the new cost in the subsequent transactions? In my current scenario, if I change the cost for item 439 in Table 2, profit in all previous transactions will change, which is not what i want.

Solution :
What I want is a macro where I input the start date and end date of the sales transactions. It would then update the cost only for those transactions. This way, my old transactions and their profit figures don't change. Can anyone help with this macro?

I would be open to any other suggestions.

Thank you so much!!
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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