Error comparing two excel files to find similarities using different values

Hi, I want to compare two excel files and generate a new excel file containing some info from both excel files with a column that gives a remark based on the value in comparison

I used read range to read the two files and then proceeded to use a nested for each row to compare the files with an if statement to compare them using an initial value and another set of if statements in the then box of the initial if statement but I’m not getting the desired output in the else box.

Here’s the workflow for clarification.Test.xaml (20.4 KB)

Hi @John_Dara,

It would be great if you can provide dummy data.
This requires a bit of study on data to see what exactly going wrong.

Okay @Lakshay_Verma would upload some

@John_Dara Cool :slight_smile:

1 Like

This are the sample dataschedule received.xlsx (9.7 KB) Schedule Sent.xlsx (9.5 KB)

Sorry to hear this, You’ll definitely learn from this forum
Welcome @6gf9zssor7

it looks like you want to find rows where the ID are matching between both tables. Such task can be done with Join.

Have a demo sample, done with the Datatable Join Activity:
Get_MatchingNonMatching_JoinActivity.xaml (13.7 KB)

For more complex requirements LINQ can help often. Have s sample on this here:
DataTable_Join_1Col.xaml (10.3 KB)

And sample with direct compair of the approaches Join Activity, LINQ for the same task:
DT_Join_1Col.xaml (10.0 KB)



Test.xaml (24.1 KB)

Is that your expected ouput.

1 Like

Yes it is. Thanks

@John_Dara Welcome :slight_smile:
Few things to add.

  1. Keep write range out of loop, that way bot will execute faster.
  2. Avoid nesting loops, max at 2nd level and same with any condition, it will help you understand your code better.

Keep Automation :slight_smile:

Thanks for this, :v:

If you would be willing to help i have another work flow i would like you to look at

Sure, I would request you to create another topic :slight_smile:

Hi @Lakshay_Verma If i want the details(Name, ID, Actual and Remark) of the datatable dtsent to show below the one with remark ‘Wrong Oracle Number’ with a different remark ‘No Ded’, Please how do i achieve that?

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