Check one list against another

itrisk

New Member
Joined
Mar 29, 2018
Messages
4
Hello,

Please help...

I need to test a list of items against a set of rules as follows:

List
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]User[/TD]
[TD]System Roles[/TD]
[/TR]
[TR]
[TD]John[/TD]
[TD]Role 1[/TD]
[/TR]
[TR]
[TD]John[/TD]
[TD]Role 2[/TD]
[/TR]
[TR]
[TD]John[/TD]
[TD]Role 3[/TD]
[/TR]
[TR]
[TD]John[/TD]
[TD]Role 4[/TD]
[/TR]
</tbody>[/TABLE]










Rules
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Rule[/TD]
[TD]System Roles[/TD]
[TD]System Roles[/TD]
[/TR]
[TR]
[TD]Rule 1[/TD]
[TD]Role 1[/TD]
[TD]Role 2[/TD]
[/TR]
[TR]
[TD]Rule 2[/TD]
[TD]Role 3[/TD]
[TD]Role 4[/TD]
[/TR]
[TR]
[TD]Rule 3[/TD]
[TD]Role 1[/TD]
[TD]Role 3[/TD]
[/TR]
[TR]
[TD]Rule 4[/TD]
[TD]Role 2[/TD]
[TD]Role 3[/TD]
[/TR]
</tbody>[/TABLE]


What I need to check:
If the user "John" has those 4 roles, which rules does he break?

So, in this case "John" breaks all for 4 rules as his 4 roles break the different combinations.

So the output could look like:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]User[/TD]
[TD]Rules broken[/TD]
[/TR]
[TR]
[TD]John[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]John[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]John[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]John[/TD]
[TD]4[/TD]
[/TR]
</tbody>[/TABLE]


Background: This would be used to see if a user's access would be in violation of a rule set that is made up of combinations of system roles a single user shouldn't have...


Any help would be appreciated!

Many thanks
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Hello itrisk

How many rules must a user violate to be denied access? I think what you can do is have a counter, and if this counter reaches a certain value then access will be denied.

So, if I violate rule 1 I’ll have a 1 in my counter, if I violate rules 1 and 2 then I will have 3 in my counter. The permutations and/or combinations of a set of 4 elements is not that many, so this can be done easily.

Hope this helps.
 
Upvote 0
It would be easier if the final report table could be organised by user like this:


Book1
AB
1UserSystem Role
2JohnRole 1
3JohnRole 2
4JohnRole 3
5JohnRole 4
Roles



Book1
ABC
1RuleSystem RoleSystem Role
2Rule 1Role 1Role 2
3Rule 2Role 3Role 4
4Rule 3Role 1Role 3
5Rule 4Role 2Role 3
Rules



Book1
ABCDE
1UserRule 1Rule 2Rule 3Rule 4
2JohnBrokenBrokenBrokenBroken
Check
Cell Formulas
RangeFormula
B2=IF(COUNTIFS(Roles!$A:$A,$A2,Roles!$B:$B,INDEX(Rules!$B:$B,MATCH(B$1,Rules!$A:$A,0)))+COUNTIFS(Roles!$A:$A,$A2,Roles!$B:$B,INDEX(Rules!$C:$C,MATCH(B$1,Rules!$A:$A,0)))>1,"Broken","")


Copy B2 formula across and down. Is that an acceptable compromise?

WBD
 
Upvote 0
Hi WBD,

That is an acceptable compromise!:)

But would this work for a list of multiple users?

Thanks
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,219
Members
452,619
Latest member
Shiv1198

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