Results 1 to 8 of 8
  1. #1
    kiranair is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2016
    Posts
    53

    To customize Round ()

    I want to round up a no based on few conditions



    1) if the values are in the range of 0.01 to 0.99 then it should be 1

    2) if the values are above 1 then a) Check the decimal if it is less than 0.2 i.e- 1.2 then round down to 1
    b) Check the decimal if it is more than 0.2 i.e- 1.21 then round up to 2


    Eg


    Question Answer
    0,22 1
    1,70 2
    19,95 20
    4,66 5
    6,40 7
    2,96 3
    0,37 1
    1,27 2
    11,12 11
    1,43 2
    1,30 2
    4,23 5
    1,66 2
    15,02 15
    1,70 2
    3,20 3
    4,30 5
    1,21 2
    12,37 13
    2,16 2
    1,11 1

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    try

    int(question)+abs(question-int(question)>0.2)

    edit:

    slightly simpler

    int(question)-(question-int(question)>0.2)

  3. #3
    kiranair is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2016
    Posts
    53
    Error showing
    The expression you entered contains invalid syntax
    you may have entered an operand without an operator-

    cursor pointing at question

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    replace question with the name of the value you want to round - include square brackets if your name has spaces or non alphanumeric characters such as #*$?

  5. #5
    kiranair is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2016
    Posts
    53
    yes working

  6. #6
    kiranair is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2016
    Posts
    53
    Hello I have small problem

    int(question)-(question-int(question)>0.2)

    This is working fine if the values in (question ) are greater than 0.2

    their is one condition in my calculation i.e if the values are in the range of 0.00- 1 then round it up to 1 and remaining is same

    if I use this int(question)-(question-int(question)>0.2) for values like 0.20- 0.01 its giving 0 but I need (1)


    can someone help me !!!!!

  7. #7
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    I submitted a function here that should do what you need.

    Here is a sample

    ?getroundedto(1.21,1,1) 'Check the decimal if it is more than 0.2 i.e- 1.21 then round up to 2

    2
    ?getroundedto(0.01,1,1) '0.01 its giving 0 but I need (1)
    1


    With this function you can do some checking and then decide to roundUp or roundDown.

  8. #8
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    I'm sure you can work the logic out yourself with a bit of thought. try



    int(question)-(question-int(question)>0.2)-(question<=0.2)

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

Similar Threads

  1. Customize access db
    By joshynaresh in forum Access
    Replies: 7
    Last Post: 02-12-2014, 12:47 PM
  2. customize a function in a form.
    By SashaSandy in forum Access
    Replies: 7
    Last Post: 09-05-2013, 11:19 PM
  3. Need to customize error statements in form
    By mfmathes in forum Programming
    Replies: 1
    Last Post: 03-29-2013, 07:38 AM
  4. Customize Report X of Y
    By sachinmalik007 in forum Access
    Replies: 3
    Last Post: 05-04-2012, 08:45 AM
  5. Customize Message Box On Command
    By jpkeller55 in forum Access
    Replies: 3
    Last Post: 09-08-2010, 09:18 PM

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