@Anil_G Sum.xlsx (24.7 KB)
Still not getting the correct output , i have attached the matched value in this excel file.
If you look at 11.32 is repeated 22 times and only one value is negative but it showed all of the value as matched. same goes for 22.64 it is repeated around 208 times but it has 188 negative value and 20 positive values but it shows them as matched
@Anil_G whatever two values sum is 0 is consider as matched.
Like in 11.32 is repeated 22 times and one value is negative -11.32 so Status is updated for 2 value as matched rest are open item.
Similarly, 22.64 is repeated 208 times out of which 188 is -ve and 20 is positive , so status for match item is updated for 40 values remaining are open item.
if you are saying 1 is repeated 20 times and -1 is also repeated 20 times then matched item are 40.
or if you are saying 1 is repeated 1 time and -1 is repeated 20 times then only 2 values are consider as matched rest are open item.
Group the amounts with the help of Math.Abs(…
Then split the the group members into the posivtive / negative value
Check how much positive values are reflected with the negative (e.g. with a stack approach)
Update the rows depending on the evaluation from above