Calculation based on previous transactions

punnu07

New Member
Joined
Apr 19, 2015
Messages
34
Hi,

I have a problem to solve.

I have a data set of 7000 transactions and I need to calculate the amount for each transaction as per below formula. Please note that calculation will be done basis of account number.

[TABLE="width: 850"]
<tbody>[TR]
[TD]Account Number[/TD]
[TD]Value[/TD]
[TD]Percentage[/TD]
[TD]Amount[/TD]
[/TR]
[TR]
[TD]ABC[/TD]
[TD]1000[/TD]
[TD]0.1[/TD]
[TD]=(B2)*C2-0[/TD]
[/TR]
[TR]
[TD]ABC[/TD]
[TD]1000[/TD]
[TD]0.15[/TD]
[TD]=(B3+B2)*C3-(D2)[/TD]
[/TR]
[TR]
[TD]ABC[/TD]
[TD]1000[/TD]
[TD]0.05[/TD]
[TD]=(B4+B3+B2)*C4-(D3+D2)[/TD]
[/TR]
[TR]
[TD]DEF[/TD]
[TD]1000[/TD]
[TD]0.1[/TD]
[TD]=(B5)*C5-0[/TD]
[/TR]
[TR]
[TD]DEF[/TD]
[TD]1000[/TD]
[TD]0.15[/TD]
[TD]=(B6+B5)*C6-(D5)[/TD]
[/TR]
[TR]
[TD]DEF[/TD]
[TD]1000[/TD]
[TD]0.05[/TD]
[TD]=(B7+B6+B5)*C7-(D6+D5)[/TD]
[/TR]
[TR]
[TD]DEF[/TD]
[TD]1000[/TD]
[TD]0.1[/TD]
[TD]=(B8+B7+B6+B5)*C8-(D7+D6+D5)[/TD]
[/TR]
[TR]
[TD]QWE[/TD]
[TD]1000[/TD]
[TD]0.15[/TD]
[TD]=(B9)*C9-0[/TD]
[/TR]
[TR]
[TD]QWE[/TD]
[TD]1000[/TD]
[TD]0.05[/TD]
[TD]=(B10+B9)*C10-(D9)[/TD]
[/TR]
[TR]
[TD]QWE[/TD]
[TD]1000[/TD]
[TD]0.1[/TD]
[TD]=(B11+B10+B9)*C11-(D10+D9)[/TD]
[/TR]
[TR]
[TD]QWE[/TD]
[TD]1000[/TD]
[TD]0.15[/TD]
[TD]=(B12+B11+B10+B9)*C12-(D11+D10+D9)[/TD]
[/TR]
[TR]
[TD]QWE[/TD]
[TD]1000[/TD]
[TD]0.05[/TD]
[TD]=(B13+B12+B11+B10+B9)*C13-(D12+D11+D10+D9)[/TD]
[/TR]
[TR]
[TD]QWE[/TD]
[TD]1000[/TD]
[TD]0.1[/TD]
[TD]=(B14+B13+B12+B11+B10+B9)*C14-(D13+D12+D11+D10+D9)[/TD]
[/TR]
</tbody>[/TABLE]

((Value of current transaction + value of all previous transactions) x NEW percentage%) - (sum of all previous values)

Can anyone please help me with a generic excel formula which can be put in all 7000 transactions or any VBA code.

Thank you in advance.
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
put B2*C2 in D2, and

=C3*SUMIF($A$2:A3,A3,$B$2:B3)-SUMIF($A$2:A2,A3,$D$2:D2) in D3, copy down
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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