Hello folks. 1st post in this forum so hello to all.

I'm trying to create a formula to use in Excel to calculate the length of a circular arc. Sounds simple enough, but it gets more complicated (At least for me, not a maths wizard). The known data will come from a CNC machine program which would comprise of a start and end point in x,y co-ordinates, a radius and rotation direction (CW or CCW) and nothing more, that is all there is to work with. So I have start point X1,Y1 and end point X2,Y2 with radius r and I know whether CW or CCW. So IF statement is available to run a choice of formulae if beneficial dependent on whether CW or CCW. I don't what anyones Excel knowledge is here, so just a note that it wouldn't necessarily need to be an all encompassing single formula, Excel has the capability to make an initial evaluation of criteria and then choose a selection of formula to run based on the result of that initial evaluation. So there could be more than one formula if that helps, but I need a mathematical means of determining which arc length to calculate.

I have found various ways to calculate arc length, but my biggest issue is I cannot find a way for the formula to be able to decide, in all scenarios from CW or CCW, whether to calculate longer or shorter of the 2 possible arcs between the start/end point (And not forgetting if the arc is 180º, which is 3rd alternative). I can do it when X0,Y0 is at centre of arc, but I can't find a way to do it when X0Y0 is outside the arc circle.

I hope that makes sense. Any suggestions gratefully accepted as this has been twisting my head since yesterday lunchtime.

Thanks

John