need help with expression to round number

Luckydvl

Registered User.
Local time
Today, 12:15
Joined
Oct 6, 2004
Messages
11
firs here is the expression that i am using

producttotal: ([CountOfProduct])/8

ex:count of product is =6 so then it would be 6/8=.75 but it actually is 1 sample so i i need it to round up but then i also have some that are like count of product is =19 so then it would be 19/8=2.375 which is actually 3 samples so can some one help me out with this expression, i need help on the report part but i figured it out so i now i am so close to finishing this report just need it to round the numbers.
 
Do you want to round ALL numbers up. What if the result is 3.01?

producttotal: Int([CountOfProduct])/8+.9)

will round up all numbers from with a decimal of .1 and up.
 
well originally that is the way i had it but the problem with that is it off by one in the total count. let say i got counts of 3,2,1,1,2

so that would be 3/8+.9=1.275
2/8+.9=1.15
1/8+.9=1.025
1/8+.9=1.025
2/8+.9=1.15
total=5.625 which rounds up to 6 in my report

but what it actually is 3/8=.375 which is =1 sample
2/8=.25 which is =1 sample
1/8=.125 which is =1 sample
1/8=.125 which is =1 sample
2/8=.25 which is =1 smaple
total=is actually 5 samples instead of 6

i want if the number is less then one the it is one but if the number is 1.5 then is is acutally 2. it will be off if i add .9 to all my result by a couple can u see what i am trying to do. i would like not to add anything to the expression cause then it would be off is it possible just to set it to round up or down is there some type of epxression or something.
 
Last edited:
producttotal: Int([CountOfProduct])/8+.9)

By using Int, the decimals are removed so

2/8 + .9 will equal 1
1/9 + .9 will equal 1

etc...
 
they why is the expression in my report coming out to be 6 instead of 5 the expression that i use in the product footer is =sum([producttotal]) and it seem to count it but it goes to 6 i added the numbers up as if they where +.9 and it comes out to 5.6 which rounds up to 6 but it actually is only 5 samples hmmmm man so close
 
ok i got it to count the right total but there is a slight problem now when it is a even amount say say like 79/8=9.8 so that would be 10 samples but now if i add the .9 it will make it 11 which is now 1 more or another example would be 40/8=6 which is the correct amount of samples but in the expression i have to add the .9 so now it would be 7

Never mind I got it yeahhh baby, thx for all the help, what i forgot to do was add the int in the first calculation thx again bro. big props to you
 
Last edited:

Users who are viewing this thread

Back
Top Bottom