Compare tables

sharshra

Active Member
Joined
Mar 20, 2013
Messages
421
Office Version
  1. 365
I have to compare 2 tables & do some checks. I'm trying to do this using dynamic arrays, but getting errors. Can the experts help to resolve this please?

I have a source table & a check table. I have to verify the roles in the source table against check table. If there is any match found in the check table, add that role in the 3rd column in the source table.

Consider the following example. Source table has name, role columns. Name abc has no matching role in the check table. So, 3rd column is blank. User cds has matching roles 2 & 3 in the check table. So, add 2,3 in the 3rd column in source table. Continue the same for the remaining names & roles. Final output should look like as shown below.

Source table:
excel problems.xlsx
CD
11namerole
12abc1,9,23,6
13cds2,9,4,8,3
14omk7,5
15jn8
16ipugb11,5
17hfnl43,8,9,2
18trhjvm12,4
19kmjh9,5,7
20rfvgh2
21rd3,11
Sheet9


Check table:
excel problems.xlsx
H
11check role
122
133
1443
155
Sheet9


Output in source table:
excel problems.xlsx
CDE
11nameroleuser check role
12abc1,9,23,6
13cds2,9,4,8,32,3
14omk7,55
15jn8
16ipugb11,55
17hfnl43,8,9,243,2
18trhjvm12,4
19kmjh9,5,75
20rfvgh22
21rd3,113
Sheet9
 
Hello,
A proposition on XL365 (in E12):
Excel Formula:
=LET(toCheck;D12:D21;roles;H12:H15;
BYROW(toCheck;LAMBDA(r;TEXTJOIN(",";TRUE;MAP(TEXTSPLIT(r;",");LAMBDA(n;XLOOKUP(VALUE(n);roles;roles;"")))))))
 
Upvote 0
Edit : sorry formula was with ";" separators, here is the "," one
Excel Formula:
=LET(toCheck, D12:D21, roles, H12:H15, 
BYROW(toCheck, LAMBDA(r, TEXTJOIN(",", TRUE, MAP(TEXTSPLIT(r, ","), LAMBDA(n, XLOOKUP(VALUE(n), roles, roles, "")))))))
 
Upvote 0
Solution
Another option
Excel Formula:
=MAP(D12:D21,LAMBDA(m,LET(s,--TEXTSPLIT(m,","),TEXTJOIN(",",,FILTER(s,ISNUMBER(XMATCH(s,H12:H20)),"")))))
 
Upvote 0

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