Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    stryder09 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    85

    another calculation problem

    I want to enter a value and it will have 3 different solutions. basically if [field1]>150 put the value 20, if [field1]>100 put the value 5, if [field1]>50 put the value 2.



    I thought maybe something like this but it doesnt work.

    =IFF([field1]>150,20,0) or IFF([field1]>100,5,0) or IFF([field1]>50,2,0)

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You do understand that say 175 meets *all* of the criteria, right?

  3. #3
    stryder09 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    85
    I guess in essence what I need it to do is if it is between 51 and 100 assign a value of 2 if it is between 101 and 150 assign a value of 5 and if it is above 150 assign a value of 20 so 175 doesn't meet the criteria because then unless above 175 if would always show 0. It is a demerit system that I am creating.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    < 51 = 0 right?

  5. #5
    stryder09 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    85
    yes that is correct

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Something like:
    =IFF([field1]<51,0,IFF([field1]<101,2,IFF([field1]<151,5,20)))
    AIR CODE so I may have the syntax wrong.

  7. #7
    stryder09 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    85
    I keep getting back the error #Name?

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Are you puting this in a form or a query? What is the actual name of [field1]?

  9. #9
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    IIF , not IFF

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Quote Originally Posted by weekend00 View Post
    IIF , not IFF
    Thanks! I seem to always make that mistake even though I know it stands for Immediate IF.

  11. #11
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    Quote Originally Posted by RuralGuy View Post
    Thanks! I seem to always make that mistake even though I know it stands for Immediate IF.
    I didn't know it stands for Immediate IF and I didn't dig into it.
    I just thought Microsoft people double the first character to distinguish from IF when they decide the IIF function. Just like some time I double the first character to make a field name from a reserved name, nName for example.

  12. #12
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    See how much wiser you are today than yesterday?

  13. #13
    stryder09 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    85
    Yes I am wiser today thank you! I was wondering why IIF?? Anyhow, my field name is [actualbagvariance]. Lol and this is only 1of like 30 built equations I need!

  14. #14
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Is this in a query or the ControlSource of a control on a form? I would put it in the query if possible.

  15. #15
    stryder09 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    85
    It's on a form but I will be putting it in a query as well soy reports outs work.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Calculation Help
    By edge5511 in forum Programming
    Replies: 4
    Last Post: 12-18-2015, 11:11 AM
  2. Need help with calculation please
    By Gabriel984 in forum Forms
    Replies: 6
    Last Post: 09-09-2010, 12:06 PM
  3. Calculation problem
    By cometdragon in forum Queries
    Replies: 2
    Last Post: 07-28-2010, 08:54 PM
  4. Calculation Help
    By ErnieS in forum Access
    Replies: 13
    Last Post: 07-08-2010, 08:35 AM
  5. Calculation
    By thestclair in forum Reports
    Replies: 1
    Last Post: 04-29-2006, 11:03 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