Set of amounts that sums to zero

vds1

Well-known Member
Joined
Oct 5, 2011
Messages
1,200
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]ID_SPAR[/TD]
[TD]ID_ITOR[/TD]
[TD]AMOUNT[/TD]
[TD]DESIRED OUTPUT[/TD]
[/TR]
[TR]
[TD]3221876[/TD]
[TD]4448945[/TD]
[TD]-51471.74[/TD]
[TD]Matched[/TD]
[/TR]
[TR]
[TD]3221876[/TD]
[TD]4448945[/TD]
[TD]-54452.02[/TD]
[TD]Investigate[/TD]
[/TR]
[TR]
[TD]3221876[/TD]
[TD]4448945[/TD]
[TD]22239.20[/TD]
[TD]Matched[/TD]
[/TR]
[TR]
[TD]3221876[/TD]
[TD]4448945[/TD]
[TD]29232.54[/TD]
[TD]Matched[/TD]
[/TR]
[TR]
[TD]3227654[/TD]
[TD]4448974[/TD]
[TD]-28956.90[/TD]
[TD]Matched[/TD]
[/TR]
[TR]
[TD]3227654[/TD]
[TD]4448974[/TD]
[TD]-25917.90[/TD]
[TD]Investigate[/TD]
[/TR]
[TR]
[TD]3227654[/TD]
[TD]4448974[/TD]
[TD]28956.90[/TD]
[TD]Matched[/TD]
[/TR]
[TR]
[TD]3227678[/TD]
[TD]4448952[/TD]
[TD]34569.00[/TD]
[TD]Investigate[/TD]
[/TR]
[TR]
[TD]3227679[/TD]
[TD]4448953[/TD]
[TD]45102.00[/TD]
[TD]Investigate[/TD]
[/TR]
</tbody>[/TABLE]

Hello Gurus,

For same ID_SPAR and same ID_ITOR , i would like to find the set of amounts which sums up to zero and insert Matched in column D, if not the Investigate. My desired output is in column D which needs to be populated using VBA. Ideally if you filter Desired output by matched then amount sum will be zero.

There could be any number of positive amounts combinations matching to any number of negative amounts combinations.

I have colored the rows which sums the amount to zero. Hope this helps.

VBA or Formula would be appreciated.

Thanks,
 
Last edited:

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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