Assign values to Excel

I have the following excel where if the column “PLAZA” is equal to “EST” and the column “DR” is equal to “D.1” then it should put in the column “CC” the value “55100”

image

1 Like

Hi
–hope these steps would help you resolve this
–use a excel application scope and pass the file path of excel as input
—inside the scope use read range activity and get the output with a variable of type datatable named dt
–now use a FOR EACH ROW activity where pass the variable dt as input
–inside the loop use a IF condition like this
row(0).ToString.Equals(“D.1”) AND row(1).ToString.Equals(“EST”)
if true it will go to THEN part where we can use ASSIGN activity like this
row(2) = “55100”

and after this for each row loop use write range activty and mention the datatable dt as input and enable the add headers property
Cheers @Ivan_torres_oliva

Read Range activity to read the excel table into a data table DT

For Each row in DT 
   intCounter = intCounter + 1
   If row("DR").ToString == "D.1" And row("PLAZA").ToString == "EST" Then
     Write Cell Activity: Address = "C" + intCounter.ToString , Value = "55100"
   End If
End For

Regards,
Karthik Byggari

3 Likes

yes it work, thanks

1 Like

Cheers @Ivan_torres_oliva

Hi @Ivan_torres_oliva

If the excel is of large data set, you can try filling the CC with the below formula with auto fill range and it does the work for you automatically

=IF(AND(B2="EST",A2="D.1"),55100, "")

For large data set, it’ll be faster than data table. If it’s very less rows says < 500 data table is much efficient and stable.