Get particular info of cells that when summed up equals zero

Hi there,
I have an excel sheet where I have to check if in the column “MONTANTE” there are values that when summed up equals zero, if yes, I have to get the row information of the column “NUMERO DOCUMENTO”.
example:
image

I have B2= “400,00” AND B8="-400,00", equals=“0”, then, I have to get the value of the cell A2=“1800002268” AND A8=“1400001018”, the same with the value 413,33 and -413,33.

Thank you in advance, cheers!

@ElissandraSilvino

Welcome to community!

Regarding your question , you can try using for each row and do the following operations:

  1. use filter datatable activity to filter the same datatable by the condition

MONTANTE = CInt("-"+row(“MONTANTE”).ToString.Trim)

and store in result_dt

  1. then use the if condition with condition as result_dt.Rows.Count<>0

if it is true, then u can extract the values from A cells by the following way

{row(“NUMERO DOCUMENTO”).ToString, result_dt.Rows(0)(0).ToString}

Hope this logic helps you

Thanks & Regards,
Nived N

Hi @NIVED_NAMBIAR , thank you for help. I just didn’t understand clearly what you mean by assignin “montante” value with “-” for.
^^"

1 Like

hey

first use the read range activity, with preserve format enabled,

then use this expression
sum= YourDT.AsEnumerable.Sum(Function(a)Convert.ToDouble(a(“MONTANTE COLUMN”).ToString))

then use the if condition with Cint(sum) = 0

hope it helps regards!

I am referring the filtering condition u can use here

hi @fernando_zuluaga Thank you, but what in my scenario I dont want to know if the whole column sum is zero, but specific values.
what Im doing currently is take first value cell which is 400,00 and going through all other negative values to check if there is “-400,00”, and there is, after I get the “numero document” corresponding to the “-400,00” and “400,00”, with the “lookup value activity” but I have to check all valeues and takes a long time.

okey, but theres is a problem,

which of the 400 value cells you want to get, because the first 3 cell will match with -400 value, so you will get around 4 document numbers, i think that your process need to change a little bit