Help with cell value replacement across multiple worksheets

Alma1219

New Member
Joined
Jun 25, 2012
Messages
1
Hi,

I am quite new to Excel and need help with the following problem:

I have three worksheets:
ROLE (worksheet 1) - contains ID number (cells A2:A13) and NAME (cells B2:B13)
PERMISSION (worksheet 2) - contains ID number (cells A2:A16) and NAME (cells B2:B16)
ROLE_PERMISSION (worksheet 3) - contains ROLE ID (cells A2:A28) and PERMISSION ID (cells C2:C28), and empty cells (where formulae are called from) for ROLE NAME (B2:B28) and PERMISSION NAME (D2:D28)

What I want to do is have formula in worksheet 3 which looks up ROLE ID from worksheet 1 and enters the ROLE NAME, then look up PERMISSION ID from the worksheet 2 and enter the PERMISSION NAME.

I have a rough working solution but only returns "No Match Found" where the ID is 0. All other non-valid IDs return the first NAME in the list.

{=IFERROR(INDEX(ROLE!$B$2:$B$14,MIN(IF(A2=ROLE!$A$2:$A$104,ROW(ROLE!$A$1:$B$13)))),"No match found.")}

{=IFERROR(INDEX(PERMISSION!$B$2:$B$50,MIN(IF(C6=PERMISSION!$A$2:$A$50,ROW(PERMISSION!$A$1:$B$40)))),"No match found.")}

These formulae output the below results into worksheet 3:

[TABLE="width: 517"]
<tbody>[TR]
[TD]ROLE ID[/TD]
[TD]ROLE NAME[/TD]
[TD]PERMISSION ID[/TD]
[TD]PERMISSION NAME[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Role 1[/TD]
[TD]1[/TD]
[TD]Permission 1[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Role 2[/TD]
[TD]2[/TD]
[TD]Permission 2[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Role 3[/TD]
[TD]3[/TD]
[TD]Permission 3[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Role 4[/TD]
[TD]4[/TD]
[TD]Permission 4[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Role 5[/TD]
[TD]5[/TD]
[TD]Permission 5[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]Role 6[/TD]
[TD]6[/TD]
[TD]Permission 6[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]Role 7[/TD]
[TD]7[/TD]
[TD]Permission 7[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]Role 8[/TD]
[TD]8[/TD]
[TD]Permission 8[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]Role 9[/TD]
[TD]9[/TD]
[TD]Permission 9[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]Role 10[/TD]
[TD]10[/TD]
[TD]Permission 10[/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD]Role 11[/TD]
[TD]11[/TD]
[TD]Permission 11[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]Role 12[/TD]
[TD]12[/TD]
[TD]Permission 12[/TD]
[/TR]
[TR]
[TD]13[/TD]
[TD]Role 1[/TD]
[TD]13[/TD]
[TD]Permission 13[/TD]
[/TR]
[TR]
[TD]14[/TD]
[TD]Role 1[/TD]
[TD]14[/TD]
[TD]Permission 14[/TD]
[/TR]
[TR]
[TD]15[/TD]
[TD]Role 1[/TD]
[TD]15[/TD]
[TD]Permission 15[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Role 1[/TD]
[TD]16[/TD]
[TD]Permission 1[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Role 2[/TD]
[TD]17[/TD]
[TD]Permission 1[/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]No match found.[/TD]
[TD]18[/TD]
[TD]Permission 1[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Role 4[/TD]
[TD]19[/TD]
[TD]Permission 1[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Role 5[/TD]
[TD]20[/TD]
[TD]Permission 1[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Role 1[/TD]
[TD]0[/TD]
[TD]No match found.[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]Role 6[/TD]
[TD]1[/TD]
[TD]Permission 1[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]Role 7[/TD]
[TD]2[/TD]
[TD]Permission 2[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]Role 8[/TD]
[TD]3[/TD]
[TD]Permission 3[/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD]Role 11[/TD]
[TD]4[/TD]
[TD]Permission 4[/TD]
[/TR]
[TR]
[TD]13[/TD]
[TD]Role 1[/TD]
[TD]5[/TD]
[TD]Permission 5[/TD]
[/TR]
[TR]
[TD]15[/TD]
[TD]Role 1[/TD]
[TD]6[/TD]
[TD]Permission 6[/TD]
[/TR]
</tbody>[/TABLE]


I cobbled together this solution by looking online so I don't fully understand what it's doing. Ideally I want it to work for any number of values since this will be a template for varying volumes of data. Can anyone help? Is this something best done via a macro (which I'd also need help with)?

Thanks very much in advance
 

Forum statistics

Threads
1,226,889
Messages
6,193,527
Members
453,805
Latest member
Daniel OFlanagan

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