Get rotation from a vector direction.

EDIT: The solution to title question is this:

Quaternion.LookRotation(Vector3 desiredDirectionOfRotation, Vector3 desiredDirectionOfUpUsuallyVector3.up);

Original (more off-topic) post:
I’m making an RTS. When I have multiple units selected and click and drag I want them to form into a row between the locations of the mouse on buttondown and buttonup and then rotate 90 degrees left from that line.

What I have a problem with is that last part.

What I tried:
Get a cross of the two points and pass it to the unit function;

Vector3 A = rightClickStartHit.point;
Vector3 B = rightClickEndHit.point;
//Vector3 AB = rightClickEndHit.point - rightClickStartHit.point;
Vector3 turn = Vector3.Cross(Vector3.up, A - B);

foreach (GameObject go in listOfSelected)
                {
                    Vector3 C = Vector3.Lerp(A, B, j);
                    go.GetComponent<Unit>().Move(C, turn);
                    j += i;
                }

Then use Quaternion.Slerp to rotate towards the euler of turn:

public void Move(Vector3 targetPos, Vector3 targetRot)
{
    isTurning = true;
    //targetRot = targetRot.normalized;
    lookRot = Quaternion.Euler(targetRot); //this gives 0?
    lookRotV3 = targetRot;
    Debug.Log("lookRot = " + lookRot);
    agent.destination = targetPos;
}

    // in Update
    if (isTurning && agent.remainingDistance <= agent.stoppingDistance)
    {
        Debug.Log("current = " + transform.rotation + " desired = " + lookRot);

        //lookRot = Quaternion.FromToRotation(transform.forward, lookRotV3);

        transform.rotation = Quaternion.Slerp(transform.rotation, lookRot, 1 * Time.deltaTime);
        //transform.rotation.eulerAngles 
        //transform.Rotate(lookRot * 1 * Time.deltaTime);
        if (Quaternion.Angle(lookRot, transform.rotation) < 16)  
        //this only stops if set to < 20 but that's ugly
        {
            Debug.Log("Stopped turning");
            isTurning = false;
        }
    }

As you can see I tried a bunch of things but I don’t understand quaternions and vectors at all. The resulting target rotation always ends up being a 0.0.0

I’ll add the object is in a plane and I only want them to rotate around the y axis.

Also additional question: How to rotate an object over time, but consistently, not like Slerp?

PS: All help highly appreciated, sorry for formatting.

The success of this line:

Vector3 turn = Vector3.Cross(Vector3.up, A - B);

highly depends on which plane you use for your RTS game. This assumes that A and B are both inside the X - Z - plane. If you use the X - Y - plane (the usual 2d GUI plane) the cross product will result either in “Vector3.forward” or “-Vector3.forward”

In addition you should make sure that “AB” is actually a non zero vector. Or in other words: make sure your two hit points are not the same.