+ Reply to Thread
Results 1 to 5 of 5

shortest between 2 numbers

  1. #1
    Forum Contributor
    Join Date
    10-09-2006
    Posts
    212

    shortest between 2 numbers

    Hi there, I have a circle of 360 and i want to find the shortest difference between 2 numbers with 360 as the maximum. I have 2 columns of numbers with the result below. Usually I can use the ABS function but when I have numbers like in the first row it doesnt work;
    Please Login or Register  to view this content.
    Like I said the ABS would work, but when the numbers in A get upto around the Max of 360 the result is wrong.

    Warmest regards,
    Martin.

  2. #2
    Forum Contributor
    Join Date
    10-30-2007
    Location
    Norway
    MS-Off Ver
    MS Office 2007
    Posts
    345
    This should do the trick with your values in A1 and B1.

    Please Login or Register  to view this content.
    ...i think

  3. #3
    Forum Moderator daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,676
    Here's another way

    =MIN(MOD((B1-A1)*{1,-1},360))

  4. #4
    Forum Contributor
    Join Date
    10-09-2006
    Posts
    212

    Thumbs up

    You guys both rock! They both work well. thanks to both.

    Warmest regards,
    Martin.

  5. #5
    Forum Guru mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,204
    =degrees(atan(tan(radians((a1-b1)))))

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1