How do I convert numbers to negative numbers?

Hello everyone,

I want to convert all column A numbers to negative. Then save as another Excel file.

Can you help me ?


@Perawat You can try Following these Steps :

  1. Read the Excel File using Workbook Read Range Activity. Get the Output as a Datatable, sat DT.

  2. Use For Each Row for the output Datatable DT.
    Inside the For Each Row use an Assign Activity in this way:
    row(“Credit Amount”) = -1*CDbl(row(“Credit Amount”).ToString)

  3. Outside the For Each row loop
    Write the Datatable to a new Output File using Write Range Activity.

If this is not what you were looking for. Please describe more on what is needed.


@supermanPunch, Will you send me the workflow?

@Perawat Can you send me the Sample Excel Data?

1 Like

@supermanPunch, Yes, I can send.
Excel.xlsx (8.3 KB)

@Perawat Can you Check this Workflow :
As I have seen that your Input Excel has some format that needs to be preserved, I am maintaining a Template of the Input file in the Output Folder, with only the Headers. After the Conversion of numbers to Negative I’m writing the Output Datatable starting from the row A2 preserving it’s original Format. (28.6 KB)

You can check the Input File and Output File, But Do not delete the Output File as it is just a Template. Then Close the Files and run the process. The Output File should be your Expected Output.


@supermanPunch, Thank you so much for your help.

1 Like

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