[Math] Difference Between Degrees on a circle

circles

What kind of math would I use to calculate the difference between two degrees on a circle? Say, 38 and 272 degrees? When I just subtract one position from another sometimes it's more than 180 or sometimes I cross over 0/360. I need keywords that can help me learn more about it. Ultimately I want to create an excel formula but I don't know what it is called. Thanks

Best Answer

If $a$ and $b$ are angles in a circle, measured in degrees, with $0\le a\le b\lt360$, then the difference between them is the smaller of $b-a$ and $360+a-b$.