+ Reply to Thread
Results 1 to 6 of 6

Determine if heading is within range of +-15 of another heading

  1. #1
    Registered User
    Join Date
    07-03-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    19

    Determine if heading is within range of +-15 of another heading

    Hi,
    I'm struggling to make a formula that will perform the following True/False scenarios
    assumptions:
    Yc = current heading
    Yh = historic heading
    Ymin = Yc -15 degrees
    Ymax = Yc + 15 degrees

    If Yh is within the range Ymin to Ymax, then TRUE, else False.

    Sounds simple enough, but when the value of Yc is within the range 345 to 15, then I can't get the formula to work.

    It has to be as a formula, NOT in VBA as the spreadsheet is updated through PI whenever a value (not included in this example) is changed.

    I have attached an example file. The formula is in column 'E'.

    Any help would be loooooooovely!!!
    Attached Files Attached Files

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Determine if heading is within range of +-15 of another heading

    In E2 and copy down,

    =ABS((0.5 - MOD( ($A$6 - D3)/360 + 0.5, 1)) * 360) < 15
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    07-03-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Determine if heading is within range of +-15 of another heading

    Shg,
    Thank you for your reply!! How does it work?

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Determine if heading is within range of +-15 of another heading

    MOD( ($A$6 - D3)/360 + 0.5, 1) calculates a difference between 0 and 1

    (0.5 - MOD( ($A$6 - D3)/360 + 0.5, 1)) translates that to a difference between -0.5 and 0.5

    (0.5 - MOD( ($A$6 - D3)/360 + 0.5, 1)) * 360 scales that to a difference between -180 and 180

    ABS takes the absolute value.

  5. #5
    Registered User
    Join Date
    07-03-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Determine if heading is within range of +-15 of another heading

    Thanks again!! huge help!

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Determine if heading is within range of +-15 of another heading

    You're welcome.

    It could be made a little more intuitive:

    =ABS(180 - MOD((180 + $A$6 - D3), 360)) < 15

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 10-25-2014, 11:28 AM
  2. [SOLVED] Look for a certain heading but if not found then move to next heading you are after.
    By Steve2107 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-03-2014, 03:02 AM
  3. [SOLVED] Sub-heading stuck at same heading number
    By Hallet in forum Word Formatting & General
    Replies: 1
    Last Post: 06-01-2012, 08:16 AM
  4. Return the heading value of MIN Range
    By Mike_Dean in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-15-2008, 05:32 AM
  5. Returning Row Heading for Top 'X' values in a range
    By Powermonger in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 02-28-2008, 06:04 PM
  6. [SOLVED] In a table produce an value by column heading and row heading
    By naflan in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-27-2005, 01:25 PM
  7. [SOLVED] how to determine column heading from lookup
    By Paul in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-25-2005, 09:05 AM

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