Results 1 to 6 of 6

Thread: Convert Excel Formula To Access
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular
    Join Date
    Jun 2012
    Posts
    65
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Convert Excel Formula To Access

    I am trying to convert an excel formula in access but don't have the knowledge to do so. Is there a way to convert this excel formula to run with my access query? This is what I am using in Excel. =IF(S2<1825,"< 5 Years Old",IF(AND(S2>1824),"> 5 Tears Old")). The Access database name is Raw_NJUNS and Column "S" is NTG Interval. I tried several things but, keep getting errors. Any help would be appreciated. Thanks.

  2. #2
    Board Regular
    Join Date
    Jun 2012
    Posts
    65
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Convert Excel Formula To Access

    I got it to work by using this formula in case anyone needs this in the future


    <>5YRS_OLD: IIf([NTG INTERVAL]<=1825,"< 5yrs",IIf([NTG INTERVAL]>1825,"> 5yrs"

  3. #3
    MrExcel MVP
    Moderator
    xenou's Avatar
    Join Date
    Mar 2007
    Location
    Clev. OH, USA
    Posts
    16,466
    Post Thanks / Like
    Mentioned
    11 Post(s)
    Tagged
    1 Thread(s)

    Default Re: Convert Excel Formula To Access

    I guess you could also try:
    <>5YRS_OLD: IIf([NTG INTERVAL]<=1825,"< 5yrs","> 5yrs")

    Using: Office 2010/Win7 (work) Office 2010/Win7 (home)

    You are rich in proportion to the number of things you can let alone.
    -- Henry David Thoreau

  4. #4
    Board Regular
    Join Date
    Jun 2012
    Posts
    65
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Convert Excel Formula To Access

    Thanks. Iíll give it a try

  5. #5
    Board Regular
    Join Date
    Jul 2010
    Posts
    445
    Post Thanks / Like
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Convert Excel Formula To Access

    Similar with your Excel formula the second IF and the AND function are not required. If can return one value if true and another if false. IF,Then,Else.

    Code:
    =IF(S2>1825,">","<")&" 5 Years Old"

  6. #6
    MrExcel MVP
    Junior Admin
    Joe4's Avatar
    Join Date
    Aug 2002
    Posts
    50,717
    Post Thanks / Like
    Mentioned
    57 Post(s)
    Tagged
    11 Thread(s)

    Default Re: Convert Excel Formula To Access

    Similar with your Excel formula the second IF and the AND function are not required. If can return one value if true and another if false. IF,Then,Else.
    Note that Access does NOT have an "IF" function. It has an "IIF" function.
    Access VBA has a IF...THEN function that works similarly to Excel's VBA equivalent.
    TIPS FOR FINDING EXCEL SOLUTIONS
    1. Use the built-in Help that comes with Excel/Access
    2. Use the Search functionality on this board
    3. A lot of VBA code can be acquired by using the Macro Recorder.

    "Give a man a fish, feed him for a day. Teach a man to fish, feed him for life!"

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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