Best/Most efficient way of rotating a group so a particular axis faces up

Hello, I’m looking for a bit of guidance.

I have a group, which has several parts in. It is always located at 0,0,0.

The scenes up axis is Y so when the group is initially created, its Y axis is aligned nicely.

I want to be able to pick which axis of the group is up (e.g. aligned with the scenes Y). Rotating it around a particular axis is easy enough, but if they have changed it several times I can only think of doing a big if/switch statement which seems quite in efficient given the possibilities

e.g. If groups current up is Y and they want it to be Z rotate around X 90 else if current up is Y and they want X rotate around Z 90.

Since it could currently be in 1 of 6 axis (im including the negatives) and will be aligning to 1 of 6 axis (again including the negatives) this will get pretty big.

So basically is there a better method to rotate a group so a particular axis aligns with the scenes Y axis?