Mathematics Problem

Hello, I want to do some addition operations in Excel. The details are as follows.
Result 1 = A – A_dbv
Result 2 = B – A_dbv – B_dbv
Result 3 = C – A_dbv – C_dbv
Input :


The output image is as follows :

Note: The specified fields will be extracted and written to the result field.

@muhammet.sezer2

Use write cell and give the value as "=A2-D2"

Then use auto fill range

Repeat same for each column

Cheers

Hi,excel is dynamic. How to write range value?
Can you show an example?

Try this :slight_smile:
result 1:

Result 1 = CDbl(row("A").ToString.Replace("₺", "").Replace(",", ".")) - CDbl(row("A_dbv").ToString.Replace(",", "."))

result 2:

Result 2 = CDbl(row("B").ToString.Replace("₺", "").Replace(",", ".")) - CDbl(row("A_dbv").ToString.Replace(",", ".")) - CDbl(row("B_dbv").ToString.Replace(",", "."))

result 3:

Result 3 = CDbl(row("C").ToString.Replace("₺", "").Replace(",", ".")) - CDbl(row("A_dbv").ToString.Replace(",", ".")) - CDbl(row("C_dbv").ToString.Replace(",", "."))

Here’s a complete example

<UiPath.Workflow>
  <Sequence>
    <Excel Application Scope Path="path\to\your\file.xlsx">
      <Read Range SheetName="Sheet1" Range="" Output="dtData"/>
      <For Each Row In DataTable>
        <Assign>
          <Variable>[Result 1]</Variable>
          <Value>CDbl(row("A").ToString.Replace("₺", "").Replace(",", ".")) - CDbl(row("A_dbv").ToString.Replace(",", "."))</Value>
        </Assign>
        <Assign>
          <Variable>[Result 2]</Variable>
          <Value>CDbl(row("B").ToString.Replace("₺", "").Replace(",", ".")) - CDbl(row("A_dbv").ToString.Replace(",", ".")) - CDbl(row("B_dbv").ToString.Replace(",", "."))</Value>
        </Assign>
        <Assign>
          <Variable>[Result 3]</Variable>
          <Value>CDbl(row("C").ToString.Replace("₺", "").Replace(",", ".")) - CDbl(row("A_dbv").ToString.Replace(",", ".")) - CDbl(row("C_dbv").ToString.Replace(",", "."))</Value>
        </Assign>
        <Write Cell SheetName="Sheet1" Cell="G" Value="[Result 1]" />
        <Write Cell SheetName="Sheet1" Cell="H" Value="[Result 2]" />
        <Write Cell SheetName="Sheet1" Cell="I" Value="[Result 3]" />
      </For Each Row>
      <Save Workbook/>
    </Excel Application Scope>
  </Sequence>
</UiPath.Workflow>

This example assumes that:

  • The columns are named exactly as in your screenshots.
  • The data starts from row 2 (row 1 contains headers).

Make sure to replace path\to\your\file.xlsx with the actual path to your Excel file.

Feel free to adapt the variable names and cell references as necessary.

@muhammet.sezer2

You can get the row count using Excel.Sheet("Sheetname").RowCount

Which can be used in range field

Excel.Sheet("Sheetname").Range("E23:E" + Excel.Sheet("Sheetname").RowCount.ToString)

Cheers

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