+ Reply to Thread
Results 1 to 6 of 6

If statement on azimuth range

  1. #1
    Registered User
    Join Date
    05-21-2012
    Location
    Earth
    MS-Off Ver
    linux + python + numpy + pandas
    Posts
    18

    If statement on azimuth range

    Hello,
    I have some azimuth data that vary from 0 through 360 degrees.
    I would like to make an IF statement on an azimuth range, for example:

    IF AziMin > 45 AND AziMax< 135 THEN 1 ELSE 0

    This is nice and easy as long as the range does not cross the North direction (i.e. Azi = 0 AND Azi = 360), but if I want a range like this:
    NW to NE, i.e. Azi from 315 degrees to 045 degrees, my simple IF statement above falls apart.

    So far I've got as far as using Sine and Cosine functions and combining them, but I'm not making much progress.
    any help or suggestions more than welcome.

    Rob

  2. #2
    Registered User
    Join Date
    06-11-2012
    Location
    Bangalore
    MS-Off Ver
    Excel 2007
    Posts
    86

    Re: If statement on azimuth range

    Hi,



    the if function goes like this =if(and(Azimin>45,Azimin<135),1,0)


    Hope this will work

    please rate if u are satisfied with this post by selecting the star from below.

  3. #3
    Registered User
    Join Date
    05-21-2012
    Location
    Earth
    MS-Off Ver
    linux + python + numpy + pandas
    Posts
    18

    Re: If statement on azimuth range

    Hi, not quite what I'm looking for sorry. I'm not looking for help to write the basic if statement in excel, but rather help in how to tackle the fact that I could have this situation:

    range min = NW = 315
    range max = NE = 015

    with the following statement;

    =IF(AND(Azimuth<45,Azimuth>315),1,0)

    a value of 350 for example (which should be included in the range), is excluded because it is larger than 315 (aok), but also larger than 45 (not ok). I need to find a way to recognise that values less than 360 degrees should be treated as "smaller" than values in the same defined range that are east of North.

  4. #4
    Registered User
    Join Date
    01-05-2010
    Location
    Jakarta, Indonesia
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: If statement on azimuth range

    Hi,
    May be this function will help..

    =IF(OR(AND(Azimuth<45,Azimuth>0),AND(Azimuth<360,Azimuth>315)),1,0)

  5. #5
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,482

    Re: If statement on azimuth range

    =IF(MIN_AZM> MAX_AZM,IF(OR(MIN_AZM<=B3,MAX_AZM>=B3),1,0),IF(AND(B3>=MIN_AZM,B3<=MAX_AZM),1,0))

    Where MIN_AZM and MAX_AZM are named range for input values and B3 contains value being tested.
    Cheers
    Andy
    www.andypope.info

  6. #6
    Registered User
    Join Date
    05-21-2012
    Location
    Earth
    MS-Off Ver
    linux + python + numpy + pandas
    Posts
    18

    Re: If statement on azimuth range

    Thank you both for your help, I'll try this and get back to you.
    best, Rob

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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