How to Compare 2 cell in excel and Update status in another cell

Hi Everyone, Pls help with this:

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.


try this by using invoke code

For Each row As DataRow In dt1.AsEnumerable
If row(0).ToString.Trim=row(1).ToString.Trim Then
End If

Sequence2.xaml (6.8 KB)

Hi @Nimmi_rv

Welcome to Community!!

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.

Hope this helps!!

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:
End If
End Sub

This is the xaml for reference if required (2.7 KB)


you can also try this by using the query ,if you don’t want use invoke code

dt1.AsEnumerable.Select(Function(r) dt1.Clone.LoadDataRow({r(0).ToString,r(1).ToString,if(r(0).tostring.trim.equals(r(1).tostring),“Passed”,“Failed”)},False)).CopyToDataTable

Hi @Nimmi_rv ,
You can use ‘For each data row’
if row(A) = row(B)
assign value to C