Merging two Excel Tables from different files using IF

Hello everyone,
thanks for reading my post.

I have 2 excel tables(table 1 , table 2) with basic columns (name, phone, country, requestDate).
I want to merge both tables in a NEW excel file(Table 3).
BUT I don’t know how to do it :frowning:

Also, There is a way to create some kind of IF?

  1. IF there are duplicates from table 1 and table 2 → DO: update requestDate and write in Table 3

  2. ELSE write range from table 1 and table 2 to table 3

Hi @kotaix

What you can do is read the excels into 2 datatables (DT,DT2) and merge these Datatables. Now you can remove duplicate rows from this datatables.


NB:Mark as solution if found useful :slight_smile:

1 Like

Thanks a lot for replying.
But how I handle the IF situation?

I want to do a flowchart decision there,
If data exist in dt 1 and dt2, I want just want to update the RequestDate from dt1 to dt3

Hi @kotaix

If you want to check any duplicates are there and based on that add a condition. Phone number will be a unique column so add a condition

dt1 = dt.DefaultView.ToTable(True,“Phone_Number”)

if (dt1.rows.count = dt.rows.count) Then no duplicates Else duplicates are there

Men you are my god!
Thanks a lot
will practice this and see how’s works.

Hi @kotaix

No brother God is great am just a human being :slight_smile:


Thanks a lot :slight_smile:
There is any way to reach you and maybe get some paid coach on specific activities?
I just want to learn more about using IF for SQL and Excel Data tables, merging tables to a new one, etc

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