Matching uneven negative and positive values in column that sums up to zero

Charlicito

New Member
Hi !

This is my first question here in this Forum, so if there is already an answer, please let me know.

I have a problem i cant solve. I need to match uneven positive and negative numbers in a column that sums up to 0. The most tricky part here is that if a certain negative number is very big it need more than one positive value to reach zero, and the sum wont be exact. See below for example, and below that the result i want to acquire:

 Firm Value 1 -48 2 -1160 3 853 4 -298 5 -1521 6 721 7 -9517 8 -1269 9 -944 10 -3946 11 -10153 12 17635 13 5485 14 4664 15 -501

<colgroup><col><col></colgroup><tbody>
</tbody>

I need the "best fit" of matching for example (if true): Firm 11 matched with Firm 13&14, Firm 5 with 3&6... and so forth until all firms are taken into account.

How do I do this?

Excel Facts

Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Thanks! I will look into it but VBA of this length is not my biggest strength....

Replies
0
Views
1K
Replies
3
Views
566
Replies
3
Views
460
Replies
1
Views
543
Replies
3
Views
7K

1,219,570
Messages
6,149,046
Members
450,853
Latest member
xtiinctt

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.

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

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