TurboTax does this calculation for you. In order for the program to correctly calculate and apply the "other state credit", the non-resident state return must be completed first, before the resident state return is done. If the state returns are not done in the correct order, the calculation will not be correct.
**Answers are correct to the best of my ability but do not constitute tax or legal advice.