How can i change text number on number format or the inverse?

How can i change text number on number format ? because i need to compare numbers and sometime its a text and sometimes is a numbers

Hey,
it’s depends on which format do you need, you can use:

Integer: CInt, Convert.ToInt32, and Integer.Parse
ex.
Cint(Value)
Integer.Parse(Value)
Cint(“3”)
Integer.Parse(“3”)

Double: CDbl, Convert.ToDouble, and Double.Parse
ex.
Cdbl(Value)
Double.Parse(Value)
Cdbl(“0.2”)
Double.Parse(“0.2”)

image

1 Like

i need to convert text to number

It’s exactly what you wanted :slight_smile:

1 Like

what format is “double”? which one i need to chose ?

Hi @Soudios

=> Use For each Row in DataTable to iterate through the rows.
=> Inside the loop give the condition in assign activity.

CurrentRow("column name")=Decimal.Parse(CurrentRow("column name").ToString)

=> Use Write Range Workbook to write the datatable back to excel.

Hope it helps

i need something easier than that :slight_smile:

@Soudios

This is an easy way only. Try that once.

Regards

Take a look to this code and try to adjust it to your process :slight_smile:
textToNumber.zip (2.5 KB)

1 Like

i have this issue :

Can you provide fully expression which you are assigning to ‘double’ variable?
Also provide screenshot of the variable types.

my mad, i didnt change the type, but when i want to write it in excel i have this issue

use tostring method:
Out_MarginExcel.ToString

Hi @Soudios

  1. Convert Text Number to Number
    CDbl(“TextNumber”)

  2. Number To Text
    Number.ToString OR (Number).ToString

Hope it will helps you :slight_smile:
Cheers!!

hi,

its not working, i have this issue when i want to convert text to number

Hi @Soudios

Can you try the below sample

CDbl(Input.Replace(" ",""))

There is a space in between numbers that’s why it is getting error

image

Cheers!!

the number is not exact, its missing “,”
245664,20

@Soudios

Try this:

CDbl(“TextNumber”.Replace(" “,”“).Replace(”,“,”"))

its not working its still missing “,” on the number
image

image

it still not working the 2 text variable are same but the bot consider they are not

image