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

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Forum statistics

Threads
1,224,823
Messages
6,181,184
Members
453,020
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