Round to nearest even dollar
Re: Round to nearest even dollar
So sorry. Yes, I believe it to be VB.NET script.
Re: Round to nearest even dollar
Hello,
Thank you.
What about this expression:jrSD wrote:So sorry. Yes, I believe it to be VB.NET script.
Code: Select all
{Round(Parts.CutPartWidth, 0)}
Re: Round to nearest even dollar
Thank you Jan! Yes, this rounding command works on my system. However, I need a command that always rounds UP & to the nearest EVEN number. Thank you in advance for any additional insight on this matter. I am stumped...
Re: Round to nearest even dollar
Hello.
Sorry, but it's possible either round up or to the nearest even number.
Could you specify what do you need to get from 3.5 and 4.5 values?
Thank you.
Sorry, but it's possible either round up or to the nearest even number.
Could you specify what do you need to get from 3.5 and 4.5 values?
Thank you.
Re: Round to nearest even dollar
Aleksey Andreyanov wrote:Hello.
Sorry, but it's possible either round up or to the nearest even number.
Could you specify what do you need to get from 3.5 and 4.5 values?
Thank you.
So, I purchase a certain material that has a pricing structure wherein all pricing is calculated based on the nearest WHOLE EVEN number.
3.2=4
4.1=6
In MS Access I am able to get the results I need in a query by using the following method:
NewColumn: round([Parts.CutPartWidth]+0.00001,1)
RoundedEven: (Int((-[NewColumn])/2))*-2
Thanks for the help...
Re: Round to nearest even dollar
!!SOLVED!!
Here is my solution:
{CINT((ROUND(Parts.CutPartWidth+0.00001,4)+1)/2)*2}
Here is my solution:
{CINT((ROUND(Parts.CutPartWidth+0.00001,4)+1)/2)*2}
Re: Round to nearest even dollar
Hello,
Sorry, maybe we did not exactly understood your question.
From your first post: "6.75 it needs to be rounded to 6. If it's 7.25 it needs to be rounded to 8."
From your previous post: "the 3.2 is rounded to 4, the 4.1 is rounded to 6". Therefore 6.75 must be rounded to 8.
Please specify - which rule is correct ?
Thank you.
Sorry, maybe we did not exactly understood your question.
From your first post: "6.75 it needs to be rounded to 6. If it's 7.25 it needs to be rounded to 8."
From your previous post: "the 3.2 is rounded to 4, the 4.1 is rounded to 6". Therefore 6.75 must be rounded to 8.
Please specify - which rule is correct ?
Thank you.
Re: Round to nearest even dollar
Ivan wrote:Hello,
Sorry, maybe we did not exactly understood your question.
From your first post: "6.75 it needs to be rounded to 6. If it's 7.25 it needs to be rounded to 8."
From your previous post: "the 3.2 is rounded to 4, the 4.1 is rounded to 6". Therefore 6.75 must be rounded to 8.
Please specify - which rule is correct ?
Thank you.
Ivan...So sorry. I did not look closely enough at 'MikeC's original post. I should have created a new thread from the outset. My need was to always round UP to the nearest EVEN. As such the following syntax is fulfilling my needs:
{CINT((ROUND(Parts.CutPartWidth+0.00001,4)+1)/2)*2}
6.75=8
7.75=8
Is there a better way to accomplish this?
Re: Round to nearest even dollar
Hello,
For example, you can add following function into the report, on the Code tab of designer:
and then use this function in expressions:
Thank you.
If you need to use this expression in several places, it is better to describe it as a function, and use this function in expressions.jrSD wrote:Is there a better way to accomplish this?
For example, you can add following function into the report, on the Code tab of designer:
Code: Select all
Function MyRound(ByVal num As Double) As Double
MyRound = CInt((Math.Round(num+0.00001,4)+1)/2)*2
End Function
Code: Select all
{MyRound(3.75)}
{MyRound(4.1)}
- Attachments
-
- MyRound.mrt
- (3.69 KiB) Downloaded 344 times
Re: Round to nearest even dollar
Ivan wrote:Hello,
If you need to use this expression in several places, it is better to describe it as a function, and use this function in expressions.jrSD wrote:Is there a better way to accomplish this?
For example, you can add following function into the report, on the Code tab of designer:
and then use this function in expressions:Code: Select all
Function MyRound(ByVal num As Double) As Double MyRound = CInt((Math.Round(num+0.00001,4)+1)/2)*2 End Function
Thank you.Code: Select all
{MyRound(3.75)} {MyRound(4.1)}
Brilliant! Thank you very much!!