Needed to round a number to nearest thousand

Hi all,
Can any one say is there any function to round a number to nearest thousand.
example == 73882 it must be rounded to 74000.
Thanks
Ravi
use small case when you are posting the questions
Edited by: Vijay Babu Dudla on Dec 15, 2008 12:09 PM

Hi
try this:
DATA: V_IN TYPE I VALUE 73882,
      V_OUT TYPE I.
DATA: V_1  TYPE I.
V_1 = V_IN DIV 1000 + 1.
V_OUT = V_1 * 1000.
WRITE V_OUT.
or
DATA: V_IN TYPE I VALUE 73882,
      V_OUT TYPE I.
DATA: V_1  TYPE I,
      V_2  TYPE I.
DATA: V_DELTA1 TYPE I,
      V_DELTA2 TYPE I.
V_1 = V_IN DIV 1000.
V_DELTA1 = ABS( V_1 * 1000 - V_IN ).
V_2 = V_1 + 1.
V_DELTA2 = V_2 * 1000 - V_IN.
IF V_DELTA1 < V_DELTA2.
  V_OUT = V_1 * 1000.
ELSE.
  V_OUT = V_2 * 1000.
ENDIF.
WRITE V_OUT.
Max

Similar Messages

  • Round the number to upper range

    Hi guys!!
    I need to round the number 5.552 to 5.60. how can I do this? even if the number is 5.51 then also it will be 5.6. How to do ?
    Thanks
    Kazi Mokarem

    Since Jens gets to introduce a fudge number, so can I :-)
    Depending on how you feel about 5.50
    SQL> SELECT ROUND(5.51 + .05, 1) round_up1,
      2         ROUND(5.50 + .05, 1) round_up0,
      3         ROUND(5.51 + .04, 1) still_round_up1,
      4         ROUND(5.50 + .04, 1) round_down0
      5  FROM dual
    ROUND_UP1  ROUND_UP0 STILL_ROUND_UP1 ROUND_DOWN0
           5.6        5.6             5.6         5.5TTFN
    John

  • Need help with Rounding a number.

    I have 3 cells each with a formula in them. Please bear with me while I try to explain this.
    Cell D18 contains the formula: =Sum(L18/C5) (L18's value is 58, C5's value is 10), So the value of the cell is 5.8. I need this number to round properly to 6. It does visually on the spreadsheet.
    Cell F18 contains the formula: =Sum(E18/F5) (E18=28, F5=8) So the actual value of F18 is 3.5 which is rounded to 4 visually on the spreadsheet.
    Cell G18 contains the formula =Sum(D18+F18). (D18 visually displays 6, F18 visually displays 4, therefore G18 should display 10). G18 actually displays 9. For some reason the calculations are still based on the actual calculations of D18 & F18, instead of the rounded displayed numbers. How do I get G18 to display the correct number of 10, rather than the rounded down number of 9?
    I'm sure there's a simple fix that I'm just not understanding. I hope I explained my problem well enough, I'd appreciate any help I can get. These numbers are to calculate insulin dosage, so I need to be sure the math is correct.
    Thanks in advance for any help!

    yvieinca wrote:
    I have 3 cells each with a formula in them. Please bear with me while I try to explain this.
    Cell D18 contains the formula: =Sum(L18/C5) (L18's value is 58, C5's value is 10), So the value of the cell is 5.8. I need this number to round properly to 6. It does visually on the spreadsheet.
    Cell F18 contains the formula: =Sum(E18/F5) (E18=28, F5=8) So the actual value of F18 is 3.5 which is rounded to 4 visually on the spreadsheet.
    Cell G18 contains the formula =Sum(D18+F18). (D18 visually displays 6, F18 visually displays 4, therefore G18 should display 10). G18 actually displays 9. For some reason the calculations are still based on the actual calculations of D18 & F18, instead of the rounded displayed numbers. How do I get G18 to display the correct number of 10, rather than the rounded down number of 9?
    The explanation is that you don't understand what you are doing.
    When you ask numbers to display 0 decimal, you don't ask it to round the contents but to display the rounded value.
    A contents remains 3.6 but the display is 4
    an other contents may be 3.6 too displaying 4
    When you sum, you ask number to add the contents (3.6 + 3.6) which is 7.2 and you ask it to display the rounded value of this result. So you correctly see 7 not 8.
    If you want to get what you described, you MUST force Numbers to round.
    First,I don't understand how you may invent such a silly thing like =Sum(L8/C5)
    You are asking Numbers to sum the result of the division L8/C5 to nothing.
    The correct syntax would ask it to calculate the quotient, no less no more.
    =L8/C5
    but here we need to round so, in D18, enter
    =ROUND(L8/C5,0)
    in F18, enter
    =ROUND(E8/F5,0)
    In G18, =Sum(D18+F18) is silly too.
    You are asking nummber to sum (D18+F18) and nothing.
    The correct formula may be:
    =SUM(D18,F18)
    or
    =D18+F18
    Yvan KOENIG (from FRANCE samedi 13 juin 2009 18:05:33)

  • Rounding to the nearest thousand

    hi
    does anybody know how to ceil and floor an integer to the nearest thousand?
    thanks in advance?

    hi friend,
    try this code, it may help you.....
    public class NT {
        /** Creates a new instance of NT */
        public NT() {
        public int roundByThousands(int val)
            int retval=0;
            for(int i=0;i<val;i=i+1000)
                int k=val-i;
                if(k<1000)
                    if(k<=500)
                        retval=val-k;
                    else
                        retval=(1000-k)+val;
            return retval;
        public static void main(String args[])
            NT nt=new NT();
            System.out.println(nt.roundByThousands(11502));
    }

  • How can I create accurate decimal dimensions when creating a new document or using the art board in Illustrator CS6? When I type in a number with a decimal, it automatically rounds the number up.

    How can I create accurate decimal dimensions when creating a new document or using the art board in Illustrator CS6? When I type in a number with a decimal, it automatically rounds the number up.

    For my part you are welcome, sdowers.
    Unfortunately, the uncertainty arising from the rounding has been up several times here in this forum.
    I just came to remember a warning that needs to be given:
    The rounding of the representation of a numerical value may be harmless in itself, but if you use it for any operation that changes the value, such as multiplication or whatever, things will go wrong because the operation will be made on the basis of the rounded value instead of the true value. So, as in your first case in post #2, 39.625 rounded to 39.63 will become 79.26 instead of 79.25.

  • Rounding stroke thickness to nearest decimal?

    I have a project where many objects have been scaled up and down during the creation of the artwork. And I'm left with some lines that are .9581 pts and some that are 1.039 pts.
    Just because I'm a neat freak, is there a script that would round the stroke thickness to the nearest .1 decimal? Or whole number? Or user selectable amount of decimals?

    Navarro Parker,
    loop through your path items of selection. This is simple, if only path items in your selection exists:
    // StrokeThicknessRoundingNearestDecimal.jsx
    // required: one or more selected stroked pathItem(s)
    // Rounding stroke thickness to nearest decimal
    // https://forums.adobe.com/message/6764907#6764907
    // regards pixxxelschubser
    var sel = app.activeDocument.selection;
    for (i=0; i < sel.length; i++) {
    if (sel[i].stroked == true) {
        sel[i].strokeWidth = Math.round(sel[i].strokeWidth*10)/10;
    But much more complicated, if there are compound paths or e.g. grouped paths or nested grouped grouped … paths and not possible for strokes which are added in the appearance palette.
    Have fun

  • Formulae - rounding down to the nearest five

    I am new to JAVA programming and not (yet) a brilliant mathematician. Can anybody tell me an algebra formula for rounding down to the nearest 5 (in 100)? Thanks in advance [email protected]

    Your question is not very clear.
    Still I think this would help
    //begin
    int remainder = number % 5 ;
    //We get the remainder
    number = number - remainder;
    //Trim down to the lower value
    if (remainder >= 3){
    number = number + 5 ;
    //If the remainder is 3 or more we should round to the higher value
    //End of block
    Hope this helps
    Shubhrajit

  • My computer crashed and I need a new serial number.  I have my product key

    My computer crashed and I need a new serial number.  I have my product key

    Duplicate thread http://forums.adobe.com/thread/1204907

  • Triing to send pictures threw e mail but it tells me I need a sender verification number. What is it

    I am triing to send pictures threw eliments 9 and it tells me I need a sender verification number. What is it and where do I find it?

    Hey,
    Just to elaborate, as you have added the email id after selecting Adobe email services. You will get an email from '[email protected]'. In this mail there will be an alphanumeric code. This is the verification code asked by Organizer. If this email is not in the inbox then check your spam folder.
    ~Andromeda

  • Need to make serial number in rdf

    need to make serial number column in report builder
    i tried to put rownum as column in the select statement but data wasnot fetched probably

    user513954 wrote:
    need to make serial number column in report builder
    i tried to put rownum as column in the select statement but data wasnot fetched probablyWhat do you mean by "was not fetched properly"? Why did not rownum work for you? Do you have the corresponding SQL?
    Cheers
    Sarma.

  • Rounding up to the nearest 0.05

    Hi guys i am trying to round a value up to the nearest 0.05. e.g. the value 94.63 would be rounded up as 94.65
    I have used big decimal with the round half up and round up modes but it still outputs 94.63
    How can I get arround this ?
    Cheers

          * Returns the value rounded up to the nearest 0.05
          * @param  double  value to be rounded
          * @return double  rounded up value
         private static double roundOff(double value)
              return Math.ceil(value / ROUNDUP_FACTOR) * ROUNDUP_FACTOR;
         }Where ROUNDUP_FACTOR = 0.05
    Edited by: fatjack on Dec 20, 2007 6:05 AM

  • Help needed- Reg: Display page number in SQL Reports

    Hi,
    I need to display page number in " page no: X of Y " format where X is current page & Y is total number of pages. Now I am able to display only the current page using ' sql.pno '. but not able to display in ' X of Y ' format.
    Any inputs in this regard will be helpful.
    Thanks & Regards,
    Anilkumar.

    Hello Anil,
    If you have the above requirement for Oracle Reports then follow the steps:
    1.In the Paper Layout view or Paper Design view, choose InsertPage Number.
    2. In the Insert Page Number dialog box, choose from the list the location for the page number.
    3.Click the desired page number format: Page Number Only or Page Number and Total Pages.
    Cheers,
    Suresh

  • I need a purchase order number immediately option in I-proc

    Hello,
    I created one catalog requisition in I-Proc, and checked " I need a purchase order number immediately" option during checkout. This requisition has been created and i even got message that "Purchase order number 45 has been reversed for you" With this being said...
    1. Where can i see this PO number ( I approved above requisition, but i can not see this PO number in PO screen)...?
    2. What does this purchase order number do?
    Thanks
    Deepak

    Hi Depak,
    Please check this doc...
    PO Create Documents
    Workflow File Name: poxwfatc.wft
    This workflow manages the automatic creation of purchasing documents. The PO Create Documents workflow starts in Oracle iProcurement when you submit a
    requisition associated with an existing blanket purchase agreement, contract purchase agreement, or catalog quotation in Oracle Purchasing. Customize the attributes in this workflow to fit your business needs.
    The following table shows the attributes that you must consider:
    1) Is Automatic Creation Allowed?
    Please change to Y
    AUTOCREATE_DOC Indicator (Y for Yes or N for No) of whether this workflow is initiated for all approved requisition lines.
    Default value: N
    2) Is Automatic Approval Allowed?
    AUTO_APPROVE_DOC Indicator of whether the purchase order approval workflow is initiated automatically after this workflow.
    Default value: N
    Please change to Y
    3) Should Workflow Create The Release?
    CONT_WF_FOR_AC_REL_GEN Indicator of whether this workflow creates, releases, or leaves them to the buyer to create using AutoCreate in Oracle Purchasing.
    Default value: N
    Please change to Y
    You can verify the changes through below query..
    select rtrim(w.name) name,
    w.text_default Value,
    rtrim(w.item_type) item_type
    from wf_item_attributes w
    where w.NAME in ('AUTO_APPROVE_DOC', 'CONT_WF_FOR_AC_REL_GEN', 'AUTOCREATE_DOC')
    Hope this will help.
    Regards,
    S.P DASH
    Another quick question to you, you mentioned UNSPENT code in your queries.. I think it should be UNSPSC code...correct me if I am wrong here..

  • We need to derive ZNUMPACK (Number of Packages) in plants depends batch

    Hi Experts,
    I have the code,it is nothing but a lookup on 0BATCH for quantity more lines greater than zero.I would like to derive it directly in the BEx Report.  That is all we have to do is count the number of batch lines.  We need to derive ZNUMPACK (Number of Packages) in plant depends upon batch. I tried it by using exceptional aggregation and tried in lot of ways. But I am not getting the solution.Please help me to solve this problem...
    Thanks,
    SVS

    Hi Amit,
      Thanks for your reply. In this scenario configurable material is involved. And first Make to Stock scenario is executed to check any material with customer entered characteristics are avialable. If its so it will determine its batch and assigned the quantity.
    If zero quantity is assigned or no quantity is assigned then I have to trigger the Make to Order scenario for rest of unconfirmed quantities in order.
    I have check it in USEREXIT_MOVE_FIELD_TO_VBAP but it was of no use. I even tried in USEREXIT_CHECK_VBAP but still no result. I am not sure what all the tables and structures i need to populate there.
    Regards,

  • Rounding a number up

    Is there anyway you can create a calculation to only round a number up and not down?

    You can use Math.ceil() to round up a number in JavaScript.

Maybe you are looking for