Results 1 to 4 of 4
  1. #1
    zero3ree is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2010
    Posts
    39

    Help with If Statement


    I need to add to the if statements that provide a color for a status.

    It needs to be red, yellow, or green depending on the percentage below or above the actual number is. I wrote this if statement but it doesn't like it.

    TIME_STAT: IIf([TOT_EST]<=[ACT10PLUS]>=[ACT10MIN],"Green",IIf([TOT_EST]<[ACT20PLUS]>[ACT20MIN],"Yellow",IIf([TOT_EST]>[ACT20PLUS]<[ACT20MIN],"Red","Need Data")))



    I am not sure how to do this in Access. Bottom line is that If the actual is in the range of 10% either way it can be green, within 20% it can be yellow, after that it is red. I put this formula in and it gave me all "Red" with the occasional "Need Data" on the blanks as my result. Any suggestions on a fix for my formula? It seems I need to have and or or between the greater or lesser but when I do that it errors.

    Thanks in advance.

  2. #2
    alcapps is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Jan 2012
    Posts
    292
    you can use conditional formatting. Lookup conditional formatting ms access on google.com and you will find out how to do this.

    Hope this helps

  3. #3
    qa12dx is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    india
    Posts
    112
    TIME_STAT: IIf([TOT_EST]<=[ACT10PLUS] and [ACT10PLUS]>=[ACT10MIN],"Green",IIf([TOT_EST]<[ACT20PLUS] and [ACT20PLUS]>[ACT20MIN],"Yellow",IIf([TOT_EST]>[ACT20PLUS] and [ACT20PLUS]<[ACT20MIN],"Red","Need Data")))

    if this doesn't give u the results u r looking for, mention the logic u r looking for and we'll help u with the function statement

  4. #4
    zero3ree is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2010
    Posts
    39
    Quote Originally Posted by qa12dx View Post
    TIME_STAT: IIf([TOT_EST]<=[ACT10PLUS] and [ACT10PLUS]>=[ACT10MIN],"Green",IIf([TOT_EST]<[ACT20PLUS] and [ACT20PLUS]>[ACT20MIN],"Yellow",IIf([TOT_EST]>[ACT20PLUS] and [ACT20PLUS]<[ACT20MIN],"Red","Need Data")))

    if this doesn't give u the results u r looking for, mention the logic u r looking for and we'll help u with the function statement
    Wasn't quite what I needed but it got my solution. I was not addressing the "and" part of the statement correctly. This is what I needed to have.

    TIME_STAT: IIf([TOT_EST]<=[ACT10PLUS] And [TOT_EST]>=[ACT10MIN],"Green",IIf([TOT_EST]<=[ACT20PLUS] And [TOT_EST]>=[ACT20MIN],"Yellow",IIf([TOT_EST]>[ACT20PLUS] Or [TOT_EST]<[ACT20MIN],"Red","Need Data")))

    Thank you for your help. Now I can go on to building my case function.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. if statement in sql statement, query builder
    By 54.69.6d.20 in forum Access
    Replies: 4
    Last Post: 09-11-2012, 07:38 AM
  2. SQL statement
    By JohnPapa in forum Programming
    Replies: 1
    Last Post: 09-19-2011, 10:42 AM
  3. Replies: 7
    Last Post: 08-17-2011, 01:49 PM
  4. If Statement Help
    By vennies83 in forum Queries
    Replies: 1
    Last Post: 06-09-2011, 03:50 PM
  5. If Then Statement Help
    By Kapelluschsa in forum Programming
    Replies: 5
    Last Post: 08-11-2010, 09:24 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums