+ Reply to Thread
Results 1 to 8 of 8

Excel 2007 : In need of a formula to check values are even or odd based on other cell

Hybrid View

  1. #1
    Registered User
    Join Date
    12-24-2010
    Location
    Ohio
    MS-Off Ver
    Excel 2007
    Posts
    89

    In need of a formula to check values are even or odd based on other cell

    Morning,

    Suffering the flu so the brain cells are not performing at peak efficiency. (not that they ever do)

    Anyway, Could someone come up with a formula for the following.

    Need to check if the value in E21 is >= 3000

    if it is then if the value in N19 is between 0 and 179

    the value of the thousands(3000, 5000,7000,etc) in E21 must be odd.

    if N19 is between 180 and 359, then E21 must be even(2000,4000,6000,etc).

    I hope that makes sense.

    Right now I can't believe anything that I think!

    Thanks in advance.

    George
    Last edited by BigGPL; 03-10-2012 at 12:50 PM. Reason: better description in subject line

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,462

    Re: In need of a formula to check values are even or odd based on other cell

    You say the value of the thousands must be odd in E21. Is there already a value which needs to be adapted? Does one of the values you indicate be entered and on what grounds?
    Last edited by Pepe Le Mokko; 03-09-2012 at 10:37 AM.

  3. #3
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: In need of a formula to check values are even or odd based on other cell

    Maybe try this:

    =IF(E21>=3000,IF(N19<180,ISODD(N19),ISEVEN(N19)),"")
    Will return True or False
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

  4. #4
    Registered User
    Join Date
    12-24-2010
    Location
    Ohio
    MS-Off Ver
    Excel 2007
    Posts
    89

    Re: In need of a formula to check values are even or odd based on other cell

    Hey Guys,

    Thanks for the replies.

    I warned you that my brain cells were misfiring.

    I should have been more clear in my explanations.

    The user enters values in E21 and in N19.

    The value in E21 represents feet above MSL (mean sea level).
    The value in N19 represents degrees of the compass, 0-359.

    What i need is a check to ensure that;

    First of all, the value entered in E21 is between 3,000ft and 18,000ft (forgot to mention the 18,000ft before)

    if so then:

    (1) if N19 is a value of 0 through 179, E21 must be any odd thousand foot MSL + 500 feet (such as 3,500, 5,500, or 7,500); or

    (2) if N19 is a value of 180 through 359, E21 must be any even thousand foot MSL + 500 feet (such as 4,500, 6,500, or 8,500).

    I hope that this better explains what I am looking for.

    Again, thanks in advance.


    George

  5. #5
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,462

    Re: In need of a formula to check values are even or odd based on other cell

    If I understand correctly, you want to determine the Flight Level depending on your heading.
    I assume that you want the first FL that is higher than the altitude you entered

    You can try this but it will return a wrong value if E21 is already a FL
    =IF(N19<180,CEILING(INT(E21/100),20)+5,CEILING(INT(E21/100),10)+5)
    I'll give it a go later

  6. #6
    Registered User
    Join Date
    12-24-2010
    Location
    Ohio
    MS-Off Ver
    Excel 2007
    Posts
    89

    Re: In need of a formula to check values are even or odd based on other cell

    Thanks for the replies.

    While getting ready to reply to Pepe with what follows at the bottom I noticed abousetta's reply.

    Thanks abousetta!

    Just modified your code a bit to:

    =OR(AND(N19<180,ISODD(LEFT(E21,1))),AND(N19>=180,ISEVEN(LEFT(E21,1))))
    This works for me!

    Thanks.

    George


    I guess I still haven't explained myself clearly. My apologies.


    I would like to make sure that the user has entered the correct VFR cruising altitude per FAA Sec. 91.159
    So if he is between 3000ft and 18000ft and heading eastward his flight level must be an odd alt, and vise versa.

    I just want to make sure that the user inputs the correct altitude for the direction he will be traveling (VFR).

    Since I'm more experienced in using javascript than in excel, I came up with this quick little js program. It does what I need, but coding this for excel is what I cannot seem to do.

       var str = e21;
       str = str.substring(0,1);             // substring(0,1) is like excel's LEFT(e21,1)
        if(e21 > 3000 && e21 < 18000)        // && means AND
        {
            if(n19 < 180 && str %2 == 0)     // %2 means divisble with no remainder
            {
              a="Bearing is Eastward. Altitude must be ODD"
            }           
                        
            if(n19 > 180 && str %2 != 0)
            {
               a="Bearing is Westward. Altitude must be EVEN"
            }
        }

    George

  7. #7
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: In need of a formula to check values are even or odd based on other cell

    May I suggest a simple solution...

    N19 --- Data Validation (whole numbers from 0 - 359)

    E21 --- Data Validation (Dropdown menu with number from 3000 - 18000 (by 500's))


    Formula in any other cell:

    =OR(AND(N19<180,ISODD(E21/500)),AND(N19>=180,ISEVEN(E21/500)))
    Attached Files Attached Files

  8. #8
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: In need of a formula to check values are even or odd based on other cell

    Thanks for the feedback George.

    Good luck.

+ 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