Sign in to your account in Outlook on the web via office.com
On the Outlook on the web navigation bar, select your name in the upper right corner.

Enter the email address of the shared mailbox that you want to access and select Open.
Another Outlook on the web session opens in a separate window, allowing access to the shared mailbox.
Select the Settings menu icon
and choose Mail.
In the Mail > Automatic processing section choose Inbox and sweep rules.

In the Inbox Rules section, choose the + (plus) icon to add a new rule.

Give the rule an appropriate name.
Add conditions, actions, and exceptions accordingly.
Select OK above the rule wizard to save the rule.
Tip: If you have multiple rules, use the move up and move down arrow buttons to set the rule evaluation order.