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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sum decimal values

Status
Not open for further replies.

grads

Programmer
Feb 2, 2001
11
0
0
US
Hi,

I'm having a report problem that I can't quite get to work correctly. I have a list of numbers something like 2326.500 and 5632.211. What I'm trying to do is sum only the decimal portion. I only want .711 to show within a field. What I'm trying to do is use val(right(transform(ex_ent),3)) but there is a problem if one of the decimals has a zero in it. It gives me 8.70. Any help would be much appreciated.
 
Use the MOD() and INT() functions:

nResult = MOD( 2326.500, INT(2326.500 )) + ;
MOD( 5632.211, INT(5632.211))

Of course, the numbers can be subsituted with variables.

Dave S.
 
I'm sorry but I forgot to mention that I'm doing these totals in a group footer and it's difficult to separate the values.
 
That's why I said variables could be used.

MOD(ex_ent, INT(ex_ent)) will return the decimal portion of whatever you use for ex_ent. You can use this as an expression wherever you need it.

Dave S.
 
DSummZZZ you rule! I am such an idiot. That worked perfectly. Thank you so much for taking the time to help me. I appreciate it so much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top