I have two matrices, one containing 3D coordinates that are nominal positions per a CAD model and the other containing 3D coordinates of actual measured positions using a CMM. Every nominal point has a corresponding measurement, or in other words the two matrices are of equal length and width. I'm not sure what the best way is to fit the measured points to the nominal points. I need a way of calculating the translation and rotation to apply to all of the measured points that produce the minimum distance between each nominal/measured pair of points while not exceeding allowed tolerances on maximum distance at any other point. That limit is higher for some pairs and lower for others. Maybe I should simplify the problem initially by solving the case of points that are rotated/translated without any measurement deviation. If you can help even with the simplified question of how to use Excel to calculate a transformation matrix given the original and resulting matrices, that would be super.

This is a sample of the data.
X Nom Y Nom Z Nom X Meas Y Meas Z Meas Upper Tol Lower Tol
118.81 2.24 -14.14 118.68 2.24 -14.14 1.00 -0.50
118.72 1.71 -17.19 118.52 1.70 -17.16 1.00 -0.50
115.36 1.53 -24.19 115.14 1.52 -23.98 0.50 -0.50
108.73 1.20 -27.75 108.66 1.20 -27.41 0.20 -0.20

Below is the type of matrix I need to calculate in order to best fit the measured points to the nominal points. I will multiply it by the measured point matrix to best fit to the nominal point matrix.
Transformation
0.999897324 -0.000587540 0.014317661
0.000632725 0.999994834 -0.003151567
-0.014315736 0.003160302 0.999892530
-0.000990993 0.001672040 0.001672040