I'm not sure if there is an equation for this, other than Percentage Yield = Actual Yield / Theoretical Yield. Although I probably confused it by talking about moles. You can just calculate the theoretical yield of compound A by mass and then use the 1 : 1 mole ratio without doing anything else with yield. (This is the 'using mass' method in the mark scheme instead of the 'using moles' method.)
Also I think they used CN instead of converting to a primary alcohol because otherwise there would be too few carbon atoms.