How to calculate the angle of 2 lines in excel

406 Views Asked by At

For each Value displayed in an excel 'line chart', I want to calculate in excel the degrees between

  • a vertical 180% line and
  • the angle of the line created for that 'Value'.
Pt (x) Value (y)
1 5
2 15
3 40

Sample display in this link with the degrees desired represented by the purple arrows

I have tried DEGREES ATAN SLOPE but not doing something correctly

Does anyone know the formula for this in excel?

1

There are 1 best solutions below

1
Dominique On

I believe this is a good candidate for your formula:

=DEGREES(PI()/2 - ATAN(SLOPE(B2:B3,A2:A3)))

Hereby a screenshot:

enter image description here

Be aware that both X- and Y-scales should be equal or very similar in order to get good results: in your drawing, the distance between 1 and 2 on the X-axis is far larger than the distance between 0 and 5 on the Y-axis, giving a completely wrong impression for the angle.