How to subtract two numbers

Hi All,

I need to subtract two numbers in a process. Please do needful to achieve this.
For ex: if I subtract 100 from 200 the answer will be 100
i.e:200-100=100

How to achieve this using UIpath??

@ushu
@palanikumar
@Palaniyappan
@Gokul001
@ppr
@Yoichi
@gantalaramu
@lakshman
@geetishree.rao

4 Likes

HI @HeartCatcher

Input1 = 200 As String
Input2 = 100 As String

Now use Assign activity like this

Output As Int

Output= CInt(Input1)-CInt(Input2)

Regards
Gokul

Hi @HeartCatcher,

What is the challenge for you here? We can help more if you describe it fully.

In case all variables are strings you can use the following assignments.

value1="200"
value2="100"
result = (CInt(value1)-CInt(value2)).ToString

Regards,
MY

1 Like

Hai @HeartCatcher

Regards,

1 Like

Hi! @HeartCatcher

You can try any one of the solution provided by

@Gokul001
@muhammedyuzuak
@Unknown_User

Please also go through the below mentioned courses

Regards,
NaNi

2 Likes

Actually I need to subtract $200-$100,
Sorry for miscommunication.
I tried your method but getting error like
“Assign: Conversion from string “$2,000.00” to type ‘Integer’ is not valid.”,

Hi,

Try this workflow
Main.xaml (9.4 KB)

Hey!

Try like this man:

Assign strInput1 = "$200"
Assign strInput2 = "$100"

Replace the $ symbol with nothing

StrInput1.Replace("$","")
StrInput2.Replace("$","")

Take one assign and Substract like this

Assign Sum(Int) = Cint(StrInput1)-Cint(StrInput2)

Now Adding the $ symbol at the end like this

Sum = "$"+Sum

This will give you the result

Regards,
NaNi