Insert a value in a column checking the other two column values

Am having a excel sheet in which am having 3 columns, i need to check for a value in first 2 columns and if it is present than i need to insert a value to the third column.Would anyone help me this?

@Akhila_Ashok Can you share the Sample Excel File ?

You can do so using a Datatable Approach.
Use Read Range Activity to get the Excel data as a Datatable, say DT
Use For Each Row with DT as it’s value
Use an If Condition to Check if the Value is present in the First Two Columns
If Present in Then Section you can use the Following Assign Statement
row(“ThirdColumnName”) = “yourValue”

Outside the For Each Row Loop, Use Write Range Activity and Write the Datatable DT back to the Excel File

1 Like

Ya I tried using loop ,but the problem is am having an excel with around 5k rows so is there any other way other than using loop?

@Akhila_Ashok Since it is an Updation you’re performing and since it is Simple, I think you should opt the Looping approach. But we can try using Linq Query’s to update on the values you need but it might be a bit complex and tedious approach.

have a look on the demo doing it with LINQ, Select-Add.Row Approach
Demo_WhenPresent_ThenUpdate_OtherCol.xaml (7.9 KB)

LINQ is about retrieval (getting something) and updating a column is not returning something.

With invoke code and the setField Method an Update can be done in case of it is absolutely needed
Update_InvokeCode_Demo_SetField.xaml (6.6 KB)

1 Like

Okay Thanks alot

1 Like

let me check and get back to you.
Thanks alot

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