Add info from a different excel, if info a cell matches

hello,

I have a short question - i have two excel files with 2 tables and i want to merge them taking into consideration the following:

  • i have a column with an unique ID in the first table
  • the second tables contains more IDs than the first one
  • if the ID from the first table is found in the second one, i want to bring on a different column some information from the second one.

What i did up to this point:

  • i created 2 data tables for both excel files.
  • i did a for each for both of them (one inside the other) and created an if condition (if row.item(0).tostring = line.item(0).to string) than a boolean variables receives true.
  • created a second if condition that if boolean is true it should write the information from the first data table and the info from the second data table that i am interested.

On the last point i have the problem, because i don’t think i am writing the code correctly. as a mention i want to write the information in a new data table.

A suggestion in the right direction, would help a lot.

Thank you,
Cristi

Hi @Cristian_Ionita, Can you provide sample input datatables and expected output datatable.

first file
image

the one i want info, base on comparing the contract columns:

image

and the final result should look like this:
image

Basically, if the contract numbers match between the two tables, i need to have the info brought in a new file - just the contract, file and whole case number.

Hi!

Have a view on this video.

Regards,
NaNi

some minor changes and it worked :smiley: thank you

1 Like

Hi @Cristian_Ionita,

My Solution:
datatableCompare.xaml (9.3 KB)

Sample input & output:
Data.xlsx (12.2 KB)

Thanks!

this also works - thank you :smiley:

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