Division between two number

How can I write into the “KOMADA” column the result obtained by dividing the “saldoeura” colimn by 1.9?

Hey @dvojinovic ,

Follow the steps

  1. Read the excel file and store the value in dt_input
  2. Create a intCounter variable and assign with 2
  3. Take for each row in data table activity and pass the dt_input
  4. Inside the for each row in data table take one assign activity and pass the value like this DoubleInputValue = Cdbl(CurrentRow("saldoeura").ToString.Trim.Replace(",",""))
  5. Now divide the value like this DoubleResult = DoubleInputValue / 1.9
  6. Use Write cell activity and in the cell pass "M"+intCounter.ToString and value you can pass the DoubleResult.ToString
  7. increment the counter after the for writecell activity like this intCounter=inCounter+1

Everything should happen in a loop

That’s all

Expressions for Write Cell activity :

What to write:
(CDbl( CurrentRow("saldoeura").ToString)/1.9).ToString()

Where to write: Excel.Sheet("Sheet1").Cell("M"+dt_inputdata.Rows.IndexOf(CurrentRow)+2).ToString())

1 Like

Hi @dvojinovic

You can make use of invoke code


For Each row As DataRow In YourDataTable.Rows
    row("KOMADA") = Math.Round(CDbl(row("saldoeura").ToString.Replace("," , ".")) / 1.9, 2)
Next

Here in the Komodo column the “,” is replaces as decimal (.)

If you want to ignore the “,”

For Each row As DataRow In YourDataTable.Rows
    row("KOMADA") = Math.Round(CDbl(row("saldoeura").ToString.Replace("," , "")) / 1.9, 2)
Next

Hope this helps!

@dvojinovic,

Just use write cell activity to write the formula in M2 cell. Then use Fill Range activity to fill the remaining column with the formula at M2 cell.

1 Like

@dvojinovic

  1. Write cell formula activity with formula as =L2/9 in M2 cell
  2. Auto fill range to fill formula down

Cheers

1 Like

Hi @dvojinovic

Use the below formula in Fill Range activity:

"=SUBSTITUTE(A2,"","",""."")/1.9"

Hope it helps!!

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