Compare tables in 2 workbooks

Status
Not open for further replies.

sharshra

Active Member
Joined
Mar 20, 2013
Messages
391
Office Version
  1. 365
I have to compare 2 tables in 2 workbooks & update a table1 in book1 with the values from table 2 in book2. Can the experts suggest the best way to do this?

Alternatively, what is the best way if both tables are in different worksheets in same workbook?

Consider the simplified table below to mimic the situation.
Table 1 in book1 has field rq, which is referred in table 2 in book2 in field rq ref. I want is to list the rq references made in table 2.

Table 1: At present, values in column `rq ref in d´ is filled manually referring to table 2. I want to use formula to get the same result.
Book1
BC
2rqrq ref in d
3rq 1d2, d4
4rq 2d8, d10
5rq 3d6
6rq 4d11, d13
7rq 5d1, d14
8rq 6d5, d15
9rq 7d4
10rq 8d12
11rq 9d7, d3, d11
12rq 10d3, d10, d15
table 1


Table 2:
Book1
BC
2drq ref
3d1rq 5
4d2rq 1
5d3rq 10
6d4rq 7, rq 1
7d5rq 6
8d6rq 3
9d7rq 9, rq 10
10d8rq 2
11d9rq 3
12d10rq 2
13d11rq 4, rq 9
14d12rq 8
15d13rq 4
16d14rq 5
17d15rq 10, rq 6
table 2
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
I am unsure of what your expected results should like as you have not provided a manual mock up. Based upon my best "guess" as my crystal ball is broken, I have the following Mcode from Power Query

Power Query:
let
    T1 = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Split1 = Table.ExpandListColumn(Table.TransformColumns(T1, {{"rq ref in d ", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "rq ref in d "),
    TT = Table.TransformColumns(Split1,{{"rq ref in d ", Text.Trim, type text}}),
    T2= Excel.CurrentWorkbook(){[Name="Table2"]}[Content],
    Split2 = Table.ExpandListColumn(Table.TransformColumns(T2, {{"rq ref", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "rq ref"),
    TT2 = Table.TransformColumns(Split2,{{"d", Text.Trim, type text}}),
    MQ = Table.NestedJoin(TT, {"rq"}, TT2, {"rq ref"}, "New", JoinKind.FullOuter),
    #"Expanded New" = Table.ExpandTableColumn(MQ, "New", {"d", "rq ref"}, {"d", "rq ref"})
in
    #"Expanded New"

Book5
GHIJ
1rqrq ref in d drq ref
2rq 1d2d2rq 1
3rq 1d4d2rq 1
4rq 5d1d1rq 5
5rq 5d1d14rq 5
6rq 5d14d1rq 5
7rq 5d14d14rq 5
8rq 2d8d8rq 2
9rq 2d8d10rq 2
10rq 2d10d8rq 2
11rq 2d10d10rq 2
12rq 10d3d3rq 10
13rq 10d3d15rq 10
14rq 10d10d3rq 10
15rq 10d10d15rq 10
16rq 10d15d3rq 10
17rq 10d15d15rq 10
18rq 7d4d4rq 7
19rq 3d6d6rq 3
20rq 3d6d9rq 3
21d4 rq 1
22rq 4d11d11rq 4
23rq 4d11d13rq 4
24rq 4d13d11rq 4
25rq 4d13d13rq 4
26rq 6d5d5rq 6
27rq 6d15d5rq 6
28rq 9d7d7rq 9
29rq 9d3d7rq 9
30rq 9d11d7rq 9
31d7 rq 10
32rq 8d12d12rq 8
33d11 rq 9
34d15 rq 6
Sheet1
 
Upvote 0
Duplicate to: Filter problem

In future, please do not post the same question multiple times. Per Forum Rules (#12), posts of a duplicate nature will be locked or deleted.

In relation to your question here, I have closed this thread so please continue in the linked thread.
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top