Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

rounding variale numbers

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I am writing a program to 3up split a file, so I find the total record count and divide it by 3 , to a variale, so is there a way to round it up at the same time. something like this: nVarable = (reccount() / 3)
but if the result is 150.5 I need 151 to be in nVarable.

any help I appreciate.

Thank you in advance,

-Mike
 
Since when diving by 3 you'll never get a .5, the question is what do want if you get 150.33333? If it's 150, the ROUND() is what you want. If it's 151, then it's CEILING() you want.

Rick
 
** round .5 and above to next higher number
nVariable=ROUND(reccount()/3)

** Truncates the decimals
nVariable=INT(reccount()/3)

** Gives the next higher number
nVariable = CEILING(reccount()/3)

Then the 'mod' % etc variations are also available. ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
LET KNOW IF THIS HELPED. ENOUGH EXPERTS ARE HERE TO HELP YOU OUT! BEST OF LUCK :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top