HOW TO COMPARE TWO COLUMN VALUES

Hi,
I want to compare two column values.
Process.xlsx (17.2 KB)
for your references.

if column2 is 200 and column3 is New then

I need output of from column1. in another excel sheet

how to do this? Could anyone help please

Thanks & Regards
Abu

1 Like

create a for loop for the datatable. then compare column2 and column3 values as required then if the values matched update column1 value of that respective row.

@Abubakkar

For Comparing follow these process.
store First Excel in Dt1
second excel in Dt2.
Use For each row in Dt1
Assign var1=row(“colname”)
use assign activity filteredDt=Dt2.Select(“[columnname]=‘var1’”).copytoDatatable()

Regards,
A Manohar

1 Like

Thanks for the help.
how to write in my output in sheet2

1 Like

@Abubakkar

This result will be stored into a data table.
just use Write Range Activity and give sheet and Data table name in it.

Regards,
A Manohar

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 build datatable activity and create a datatable with column structure we want say for example create the same structure as we have now in dt I order to store only the value that matches the condition
and get the output as a variable of type datatable named Finaldt
—now use a for each row loop and pass dt as input
—inside the loop use IF condition like this
row(1).ToString.Equals(“200”) AND row(2).ToString.Equals(“New”)
If true it will get into THEN part where we can use a Add datarow activity And in the array row property mention as {row(0).ToString,row(1).ToString,row(2).ToString}
And in the datatable mention as Finaldt

That’s all you are done
Cheers @Abubakkar

1 Like

i got this error

1 Like

Fine
The datatable Dt1 has no value it seems kindly check once with the read range whether the sheet is correctly read and check with the scope of the variable Dt1 in the variable panel whether it is with global scope
—and once after that the condition in IF should be like this
row(1).ToString.Equals(“200”) AND row(2).ToString.Equals(“New”)

Cheers @Abubakkar

1 Like

How to write my string output in sheet2

This step would do that
And if we don’t want all the to values and only the row(0) value the we can create a datatable with build datatable with only one column and mention the array row property of Add Datarow as {row(0).ToString}

Cheers @Abubakkar

1 Like

Main(Autosaved).xaml (20.3 KB)

Please check my xaml file

1 Like

i checked your xaml
yah that would work either but a small changeimage

everything looks fine
please go ahead, execute it and let know for any queries or clarification
Cheers @Abubakkar

1 Like

i want this ouput . Can i use while loop for write cell activity?

1 Like

Well the method you are using would work actually
Didn’t that buddy
Cheers @Abubakkar

2 Likes

Thanks @Palaniyappan.
It’s working fine. but May i know build data table and add data row is necessary in this case?

1 Like

well not exactly
but that is more reliable when you have more number of datatable and if you are accessing them simulataneously
thats why buddy
Cheers @Abubakkar

2 Likes