Rounding to nearest half
Using Crystal 2008 Dev
Question on rounding,
I have a formula that displays my running total number, I need to format the 1st decimal. Basically if I have 2.3 I need that to round up to 2.5, or if I have 2.2 I want this to round down to 2.0. I have tried many different ways and can't figure out how to do this.
Any Ideas?
Thanks,
Glenn
Glenn,
Try using a formula similar to the following;
numbervar r:= - truncate();
if r <= .2
then
truncate()
else if r > .2 and r <= .7
then
truncate() + .5
else
truncate() + 1
Similar Messages
-
Tax (VAT) Amount rounding to nearest rupee.
Dear Experts,
When ever we are using and VAT tax code its not rounding the Tax Amount to nearest rupee, when I check the parameters of condition type JIP5 the rounding rule is set to commercial rounding still its not rounding to nearest rupee and as per my understanding its rounding it to nearest 10 paise rather than to nearest rupee.
So please suggest how to make it rounding to nearest rupee.
RegardshI!
You cant rounding off for VAT amount for sales and purchases. The difference amount (digits) in sales document or purchase document will be rounded off with condition type matain in pricing procedure. There is no config setting for this rounding off for VAT calculation. If it necessary, you can contact your ABAP developer. Actually you no need to rounding off that VAT figure. You can rounding off the invoice amount to near rupee with condition type in pricing procedure. -
Hello experts,
At our client, for XXX currency payments, the amount should be rounded to the nearest 5 cents. For example, 100.02 should be rounded down to 100.00 and 100.03 should be rounded up to 100.05.
I did the config at OB90, wherein I added the following line:
COCD XXX 5
But still, when I create the invoice and run the payment program, the currency is not getting rounded to nearest 5. Does anyone have an idea on what I might be missing down here...
Please advise!
N,
All answers will be duly rewarded.From the IMG activity documentation in SPRO for OB90, it looks like this setting will be applicable only to cash discounts. It says that the amounts you enter into the system (Vendor invoice) should have multiples of 5 after the decimal point (if you specify 5 as the rounding unit) and then the cash discount % calculated will be rounded by the system to 5.
You will also need to define accounts for cash discount in OBXU.
Example (from IMG activity documentation)
For Switzerland, you decide that five centimes is to be the smallest denomination for payment transactions. For Swiss company codes and the Swiss franc, you therefore enter 5 in the "Rounding unit" column. Cash discount amounts are then rounded off to this currency unit. In the case of Swiss franc amounts entered manually, that part of the amount after the decimal point must be divisible by five. -
Rounding time field to nearest half hour
Post Author: fiscyn
CA Forum: Formula
Is there a way to round a time field?
For example, if a time field is from 9:01 to 9:14 I want it to round back to 9:00;
9:15 to 9:29 or 9:31 to 9:44 I want either option to round to 9:30
and 9:45 to 9:59 I want to round to 10:00.
I want to keep the original time and have the rounded time listed next to it. Also I want this for a 24 hour clock, military time. Don't know if that makes a difference.
Any help is appreciated.
Thanks.Post Author: fiscyn
CA Forum: Formula
I'm slowly getting this to work. Just a couple problems, minor I hope.
I used the CTime function and used the rounding formulas for minutes and hours as you suggested. It works great. But the results for the hours come out as 12.00 and the minutes as 30.00 or 0.00. How do I drop the decimals? I tried the totext, 0 function, but the numbers don't line up correctly. If the hour is 9.00, it drops the zero place holder. So if 9 and 10 are lined up, the 9 is above the 1 instead of the 0.
It works fine for the minutes except I end up with 0 instead of 00. Any suggestions?
I greatly appreciate the help so far. Thank you. -
WT rounding to nearest $
I want to be able to add hours to a wage type as well as dollars for the recurring payments. The calculation needs to round up to the nearest dollar.
I understand That in table T511 I need to put a "+" sign against amount and number both.
For rounding it to nearest dollar, I need to put "100" as a value in rounding divisor.
Please let me know if I'm not on correct lines.
ThanksExperts, Any inputs plz....
-
Formula rounding to nearest whole number
Hello,
I have created the following formula ( Metrics."# of Leads Resulting in Won Opportunity"*100 /Metrics."# of Leads" ) and displayed the results in percentage but it looks to round to the nearest whole number does anyone know why this might happen. Also i am using 2dp in the results i am hoping to get the actual result rounded to 2dp and not the nearest whole number.Hi !
I think that if you add the ROUND function, this will work... :
ROUND(Metrics."# of Leads Resulting in Won Opportunity"*100 /Metrics."# of Leads", 2)
Hope this will help, feel free to ask more !
Max -
Rounding To Nearest Decimal Place
Hey Flash Family,
I am getting the correct output i want but is also giving me
like 8 numbers after the decimal place...all i want is the numbers
rounded to the nearest cent meaning only 2 numbers to the right of
the decimal point....what do i need to add to the current code to
correct this issue.
Thanks N Advanceattach that code to the first frame of your main timeline.
then anytime you need to change the format of a number like
_root.how.ROIM.val_tcost use:
_root.return2DecPlaces(_root.how.ROIM.val_tcost); -
Hi
I have a column which holds the byte size of the data row. I would like to round this to the nearest .5
example
1.23453 = 1
1.345 = 1.5
1.6523 = 1.5
1.7893 = 2
Does anyone know how to do this easily without have to cerate an user defined function.
Cheers
GaryBluShadow wrote:
Ah, beaten by the young lady with the trombone. ;)
laughs Flattery will get you everywhere *{;-) -
Hi,
I need to round 252476480.00 to its nearest Hundred - 252476500.
Here is the code which I have
import java.math.*;
public class TestBigD {
public static void main(final String[] args) {
BigDecimal bd = new BigDecimal("252476480.00");
BigInteger bi = new BigInteger("0");
bi = bd.setScale(2, BigDecimal.ROUND_UP).toBigInteger();
System.out.println(bi);
Any Suggestions ?
Regards
MuraliHello
if you don't need BigDecimal use something like this
double d = 252476480.00d;
long toNearestHundred = Math.round(d/100)*100;
regards
Franz
reward points if useful -
Help with rounding to nearest multiples of n-1 !!
i need help writing part of a program;
start with int n, then round ***up*** to the nearest multiple of n-1; then round **this** value up to the nearest multiple of n-2. (the final step is to round up to the nearest multiple of 2)
eg
if n=10;
9 -> 18
8->24
7->28
6->30
2->34.
Please help me with this, i'm really not sure where to begin !it's a program to do with the approximation of pi;
so far i have;
public double pi (int n) {
double f; (this is the final value of the nearest
multiple of 2)
then from here i'm really not sure how to go about
it..... in other words i haven't gotten very far.Okay. I'm currious as to how this helps in the approximation of PI. Would you mind posting that?
I'll give you a few hints. The mod operator "%" tells you the distance a number is from the multiple of n immediately bellow a positive number.
The Math.IEEERemainder function tells you the distance a number is from the nearest multiple of n (whether above or below).
I'll leave it to you to figure out how to find the nearest multiple ABOVE the number, and how to use that to round the number. It's actually not all that hard.
- Adam -
Hi all programmers,
I am a FICO functional consultant. I have got an issue that I think and was told that it can be solved by an ABAPer. The issue is described below:
"I am encountering a serious production issue. On the FB60 screen when I enter the amounts in the line items and select the the respective tax code, my system calculates the tax amount as $0.06 where as when I calculate on my calculator it is coming up as 0.0565. Because of this my total balance is offsetting by 1 cent ($0.01). I want my SAP system also to round off to $0.0565 instead of $0.06. Is there any way to do this setting. I know I can change the value manually under tax tab. But, there are so many invoices like this and calculating the tax manually and then entering the right decimal value in the tax tab will not serve my purpose."
Being a functional person and with no ABAPer's support, I request you guys to please help me from scratch (inclusing which t.code to use) on solving this issue by changing or creating a programming routine.
<b><REMOVED BY MODERATOR></b>
Thank you,
SONY
Title and Message were edited by:
Alvaro Tejada GalindoHi,
Please try this to create program routine.
DATA: N1 TYPE P DECIMALS 4 VALUE '0.0565',
N2 TYPE P DECIMALS 2.
MOVE N1 TO N2.
WRITE: N2.
Regards,
Ferry Lianto -
Rounding to nearest decimals--VERY URGENT
Hi all,
I am encountering a serious production issue. On the FB60 screen when I enter the amounts in the line items and select the the respective tax code, my system calculates the tax amount as $0.06 where as when I calculate on my calculator it is coming up as 0.0565. Because of this my total balance is offsetting by 1 cent ($0.01). I want my SAP system also to round off to $0.0565 instead of $0.06. Is there any way to do this setting. I know I can change the value manually under tax tab. But, there are so many invoices like this and calculating the tax manually and then entering the right decimal value in the tax tab will not serve my purpose.
PLease help me with this as it is a very urgent issue.
I would surely award points for any kind of positive help.
Thank you,
SONYHi,
As far as my knowledge goes SAP bydefault rounds off to 2 digits. If you want any changes in that you will have to take the help of ABAPer and write the routine to change the number of decimal points.
Regards
Santosh Hegde -
Rounding off to nearest decimal point
i have these values
35.2
35.3
35.4
35.5
35.7
35.8
35.9
36.0
i am looking for indexes closet 35.74 in my array. (which is index 4.)
i used the "round to nearest" function and it gave me 36.
which is index 7.
what other ways to get the right index?
Solved!
Go to Solution.You will always have some difficulties with rounding to a specific number of digits after the decimal point because of the way numbers are represented in binary. When expressed in binary 0.1 is an infinitely repeating expression. Regardless of the display the internal representation of the number always uses the maximum resolution for the data type (8 bytes for DBL).
So you need to be very careful to define exactly what you want. If you have an array of values (regardless of the way they are displayed) Then you can find the closest to a Test Value by subtracting Test Value from the array and finding the minimum of the absolute values of the differences.
Note that in the image below the same values are in Array and Array 2 with the display on Array 2 set for 20 siginficant digits.
Lynn -
hi,
I have the following code :
NumberFormat nf = NumberFormat.getInstance();
nf.setMaximumFractionDigits(2);
nf.setMinimumFractionDigits(2);
String fTax1 = nf.format( 1.245 );
String fTax2 = nf.format( 1.255 );
String fTax3 = nf.format( 1.265 );
the results are :
fTax1 = 1.24
fTax2 = 1.26
fTax3 = 1.26
Can anyone help me to answer that ???
Thanks !!!!Banker's rounding is being used here
It rounds the numbers to the nearest even digit - 1.245 rounds to 1.24, 1.255 rounds to 1.26, 1.265 rounds to 1.26.
From the javadocs of DecimalFormat and BigDecimal.ROUND_HALF_EVEN:
Rounding
DecimalFormat uses half-even rounding (see ROUND_HALF_EVEN) for formatting.
ROUND_HALF_EVEN
public static final int ROUND_HALF_EVEN
Rounding mode to round towards the "nearest neighbor" unless both neighbors are equidistant, in which case, round towards the even neighbor. Behaves as for ROUND_HALF_UP if the digit to the left of the discarded fraction is odd; behaves as for ROUND_HALF_DOWN if it's even. Note that this is the rounding mode that minimizes cumulative error when applied repeatedly over a sequence of calculations. -
The Automatic Withholding Tax is set to calculate AWT Invoice at the time of Payment. The Client wants the amount to be deducted in Whole Numbers (Rounded to nearest Dollar). E.g. if the Invoice is for $710 and the Tax Rate is 3.5% the tax to be deducted should be $25 (not $24.85).
Invoice = $710
WHT = $25
Payment = $685
AWT Invoice = $25
Is there anyway possible to acheive this?
- R12.1.2
- Linux x86 64
Thanks & Regards.Hi All,
Although a functional option is discussed in this thread, here is a technical detail.
AP_CALC_WITHHOLDING_PKG calculates amount. In it, for instance for this sample following statement is run.
SELECT ap_utilities_pkg.ap_round_currency(710*3.5/100, 'EUR')
FROM dual;
It returns 25.84 because it checks select FC.minimum_accountable_unit, FC.precision
from fnd_currencies FC
where FC.currency_code = 'US';
and rounds it. So to me, if there is n functional solution found, since you cannot change precision only for AWT, it's better customize AP_CALC_WITHHOLDING_PKG to call a custom rounding for AWT.
Hope this guides.
Bilal Sarioz
Maybe you are looking for
-
How to best generate a unique alphanumeric key
Hi: I have a requirement to generate a unique alphanumeric key 20 characters long. I know that I can use sys.dbms_random.string('X', 20) but I also have a requirement to not include certain characters that could be missread, i.e. no 0 (zero), O(u
-
IS-Retail:1 step pricing
Hi All, Can anyone explain me what is 1 step pricing.in IS-Retail.tell me with full details the IMG and Easy Access settings.and any other settings required.Explain me clearly. reply soooooon Thanks mahi
-
How do I copy printer software files from a folder on my desktop to a CD?
How do I copy printer software files from a folder on my desktop to a CD?
-
Washed out colors with Canon Pro9000 using ICC profiles
I recently bought a brand new Canon Pro9000 printer and have a problem getting acceptable results when using the supplied ICC profiles. I believe I am doing everything by the book. First I select the correct ICC profile for the printer and the paper
-
Identify material ledger activation
hi, how to identify material ledger activation date through document. regards. Lodhi.S