VBA HELP: Formula to rebalance negative

imanoob

New Member
Joined
May 19, 2018
Messages
1
Hello,
I am new to this forum and i am having issues with adding the value of the next cell to the negative value of the previous cell.
Cell values are dynamic and not always in order. Is there an excel or vba command to get the value of positive numbers and
add it on the negative value to make it positive and rebalance?

[TABLE="width: 500, align: left"]
<tbody>[TR]
[TD]123[/TD]
[TD]456[/TD]
[TD]789[/TD]
[TD]1011[/TD]
[TD]123[/TD]
[TD]description[/TD]
[/TR]
[TR]
[TD]1000[/TD]
[TD]200[/TD]
[TD]1888[/TD]
[TD]-2088[/TD]
[TD]-1000[/TD]
[TD]dynamic amount[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]from[/TD]
[TD]to[/TD]
[TD]amount[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]123[/TD]
[TD]1011[/TD]
[TD]1000[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]456[/TD]
[TD]1011[/TD]
[TD]200[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]789[/TD]
[TD]1011[/TD]
[TD]888[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]789[/TD]
[TD]1213[/TD]
[TD]1000[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]












if checked the total amount of negative values is equal to -3088
now I did rebalance it by adding the value of the positive amounts from left to right.
The total value of the positive amounts is also 3088. Now after rebalance there's no more negative values.

Do i have to write a function for this or a simple loop will do the trick?
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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