I have 2 string values in 2 different cells, How do I need to compare 2 cells and Update the Status in Another Cell?
For Example:
Column A: MYR 1000
Column B: MYR 1000
In Column C:–> I need to compare column A&B and If both are the same In Column C status need to come as Passed.
1. Read Range activity (Read the Excel file into a DataTable, let's call it 'excelDataTable').
2. For Each Row activity:
- DataTable: excelDataTable
3. Inside the loop, use an If activity to compare the values in Column A and Column B.
- Condition: row("Column A").ToString = row("Column B").ToString
4. If the condition is true, update the Status in Column C to "Passed" using an Assign activity.
- To: row("Column C")
- Value: "Passed"
5. Use a Write Range activity to write the modified DataTable back to the Excel file.
Step 1:Use read range to read the Excel file store it in data table variable.
Step 2:Use invoke code with code given below with the in argument as the datatable variable from step one
step 3:Use Write range to write the update data
Code inside invoke code would be:
dt_Sample.AsEnumerable.ToList.ForEach(Sub(x)
If(x(“ColumnAName”).ToString.Trim.Equals(x(“ColumnBName”).ToString.trim))
x(“ColumnCName”)=“Passed”
else
x(“ColumnCName”)=“Failed”
End If
End Sub
)
This is the xaml for reference if required BlankProcess5.zip (2.7 KB)