Loop value in column to find accumulate balance movement

SamKhem

Board Regular
Joined
Mar 18, 2024
Messages
50
Office Version
  1. 2016
Platform
  1. Windows
Dear Senior member
Good morning. I would like request you to guide run vba excel with data by loop in code 100,000 rows then make add balance to column F from amount in column D when column E change accumulate balance as show below.
Book1
BCDEFG
1CODEREFERENCEAMOUNTACCUMULATE BALANCE
266333356,574.00Balance start
3663330MDHGZ18P(77,000.00)279,574.00
4663330G67GJ0WJ(20,000.00)259,574.00
56633308BJ9LHGB(200,000.00)59,574.00
6663330B35FF34Y412,600.00472,174.00
7663330G6KK61RJ(200,000.00)272,174.00
8663330LPRG1RBZ(16,500.00)255,674.00(16,500.00)
9663330VSTQ8XDT4,000,000.00(3,744,326.00)
106633314QC339LY(4,127,000.00)382,674.00382,674.00
1136058(47,543.20)Balance start
123605804XMQGP6J(1,500.00)(49,043.20)
133605805GL47DZB450.05(48,593.18)
143605805C1T189N2,397.48(46,195.70)
1536058159MDR8PQ50,630.204,434.504,434.50
1636058159M88ZPY50.004,484.504,484.50
17360580RQC3CZF7(5,000.00)(515.50)
18360580PMZY7QYF(484.50)(1,000.00)
19360581,000.001,000.00Balance start
203605804XMQGP6J(1,500.00)(500.00)
2136058159M88ZPY(100.00)(600.00)
Sheet1
Cell Formulas
RangeFormula
F8F8=D8
F10,F15:F16F10=E10
 
Last edited:

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
What columns are D,E,F?
Which cells are your desired results? (yellow cells?)
Try to post a minisheet with XL2BB
 
Upvote 0
What columns are D,E,F?
Which cells are your desired results? (yellow cells?)
Try to post a minisheet with XL2BB
Yes please recheck. Please change amount F8=-16500 to 255,674 (F8 to E8). Thanks
 
Last edited:
Upvote 0
What determines the display results in F8, F10, F15, F16, and F19, but not in other cells?
Once again, please upload minisheet (via XL2BB) then we have not to re-input again manually
 
Upvote 0
Result in F column refer to change accumulate balance in column E from positive to negative or negative to positive.
Sorry please recheck.
Book1
BCDEFG
1CODEREFERENCEAMOUNTACCUMULATE BALANCE
266333356,574.00Balance start
3663330MDHGZ18P(77,000.00)279,574.00
4663330G67GJ0WJ(20,000.00)259,574.00
56633308BJ9LHGB(200,000.00)59,574.00
6663330B35FF34Y412,600.00472,174.00
7663330G6KK61RJ(200,000.00)272,174.00
8663330LPRG1RBZ(16,500.00)255,674.00255,674.00
9663330VSTQ8XDT4,000,000.00(3,744,326.00)
106633314QC339LY(4,127,000.00)382,674.00382,674.00
1136058(47,543.20)Balance start
123605804XMQGP6J(1,500.00)(49,043.20)
133605805GL47DZB450.05(48,593.18)
143605805C1T189N2,397.48(46,195.70)
1536058159MDR8PQ50,630.204,434.504,434.50
1636058159M88ZPY50.004,484.504,484.50
17360580RQC3CZF7(5,000.00)(515.50)
18360580PMZY7QYF(484.50)(1,000.00)
19360581,000.001,000.00Balance start
203605804XMQGP6J(1,500.00)(500.00)
2136058159M88ZPY(100.00)(600.00)
Sheet1
Cell Formulas
RangeFormula
F8,F19,F15:F16,F10F8=E8
 
Upvote 0
OK, try

Book1
BCDEF
1CODEREFERENCEAMOUNTACCUMULATE BALANCE
266333356574 
3663330MDHGZ18P-77000279574 
4663330G67GJ0WJ-20000259574 
56633308BJ9LHGB-20000059574 
6663330B35FF34Y412600472174 
7663330G6KK61RJ-200000272174 
8663330LPRG1RBZ-16500255674255674
9663330VSTQ8XDT4000000-3744326 
106633314QC339LY-4127000382674382674
1136058-47543.2 
123605804XMQGP6J-1500-49043.2 
133605805GL47DZB450.05-48593.18 
143605805C1T189N2397.48-46195.7 
1536058159MDR8PQ50630.24434.54434.5
1636058159M88ZPY504484.54484.5
17360580RQC3CZF7-5000-515.5 
18360580PMZY7QYF-484.5-1000 
193605810001000
203605804XMQGP6J-1500-500 
2136058159M88ZPY-100-600 
Sheet2
Cell Formulas
RangeFormula
F2:F21F2=IFERROR(IF(E2<0,"",IF(OR(AND(B2=B3,SIGN(E2)+SIGN(E3)=0),AND(B2=B1,SIGN(E2)+SIGN(E1)=0)),E2,"")),"")
 
Upvote 0
Solution
OK, try

Book1
BCDEF
1CODEREFERENCEAMOUNTACCUMULATE BALANCE
266333356574 
3663330MDHGZ18P-77000279574 
4663330G67GJ0WJ-20000259574 
56633308BJ9LHGB-20000059574 
6663330B35FF34Y412600472174 
7663330G6KK61RJ-200000272174 
8663330LPRG1RBZ-16500255674255674
9663330VSTQ8XDT4000000-3744326 
106633314QC339LY-4127000382674382674
1136058-47543.2 
123605804XMQGP6J-1500-49043.2 
133605805GL47DZB450.05-48593.18 
143605805C1T189N2397.48-46195.7 
1536058159MDR8PQ50630.24434.54434.5
1636058159M88ZPY504484.54484.5
17360580RQC3CZF7-5000-515.5 
18360580PMZY7QYF-484.5-1000 
193605810001000
203605804XMQGP6J-1500-500 
2136058159M88ZPY-100-600 
Sheet2
Cell Formulas
RangeFormula
F2:F21F2=IFERROR(IF(E2<0,"",IF(OR(AND(B2=B3,SIGN(E2)+SIGN(E3)=0),AND(B2=B1,SIGN(E2)+SIGN(E1)=0)),E2,"")),"")
Perfect Worked. Thank for support.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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