Remove -ve sign from intVariable

Hello Everyone,
I’m getting an issue in the excel, i have to sum one column data and write it into an intVariable but that variable contains “-ve” sign, so how can i remove that sign without changing anything.

Thanks in advanced.

@Tushar_Gupta1 Math.Abs(-1) will return 1. I think you can use it accordingly, but if this is not what you needed then you may have to explain a bit more.

@supermanPunch thanks for the reply i’ll go through this and let you know.

1 Like

@supermanPunch, If that data stored in an integer variable and then how can I use Math.Abs?

@Tushar_Gupta1 If you’re Integer variable is Number , then you can use Math.Abs(Number)

So the thing is variable contains dynamic value every time when bot runs.

@Tushar_Gupta1 You can check for all input numbers using that method

If my variable is intSum then I should write the expression as follows

Math.Abs(intSum.ToString)

@Tushar_Gupta1 Ok. I got the point. Use it in this way :

Math.Abs(CDbl(intSum.ToString))

1 Like

@supermanPunch Thanks for the solution but can you please explain me what is CDbl.

1 Like

@Tushar_Gupta1 It’s the Convert to Double method that you can use on Strings or Integer values to Convert to a Double value. The Math.Abs() method accepts only Double values, hence we would have to convert the number to a Double in order to make it work

1 Like

@supermanPunch Thnkyou for explaining…

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.