Convert column to number format or another way to concatenate

I have the following problem:

From a data table generated from a text file, I extract a column with numeric values. The problem is that when I write it to the file I need, it pastes it without formatting.

When concatenating the data, it includes the .00, and I need to prevent this.

That is, if the quantity is 545.00, I need it to only consider “545” when concatenating, but if the quantity is 545.42, then it should include the decimals.

How can I make this work?

Hi, @alexis.mendoza.rpa

To remove .00 from whole number and keep decimal use this:

If CDbl(value) Mod 1 = 0 Then
    value = CInt(value).ToString
Else
    value = value.ToString
End If

This will keep whole number as 545 and decimal as 545.42

La solución fue cambiar el formato de cada celda con una actividad de for each row

for each row in DataDatble

assign :

current row(“columname”)

=Convert.ToDouble(Currentrow(“Columname”).ToString.Trim)

Your approach works to convert the value to a Double, but it may still show .00 for whole numbers when you convert it back to a string.

To drop .00 only for whole numbers, update the assign with:

If CDbl(CurrentRow("ColumnName").ToString.Trim) Mod 1 = 0 Then
    CurrentRow("ColumnName") = CInt(CurrentRow("ColumnName")).ToString
Else
    CurrentRow("ColumnName") = CDbl(CurrentRow("ColumnName")).ToString
End If

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