help with round function

S

Scott

i would like to use the round function so that if the 1st
decimal place is >.6 it rounds up and <.4 it rounds down,
but does nothing if =.5

can this be done?
 
J

Jason Morin

If you mean greater than or *equal* to .6, try:

=IF(MOD(A1,1)=0.5,A1,INT(A1)+(MOD(A1,1)>=0.6)*1)

HTH
Jason
Atlanta, GA
 
S

Sandy Mann

=IF(MOD(A1,1)=0.5,A1,INT(A1)+(MOD(A1,1)>=0.6)*1)

You don't actually need the *1 because the addition of the INT and MOD
functions will convert the Boolean.

=IF(MOD(A1,1)=0.5,A1,ROUND(A1,0))

will also work

Regards

Sandy
 
J

Jason Morin

For some reason I have to multiply my boolean values by 1
in order sum them. I haven't figured out why.

Jason
 
M

Myrna Larson

If you are using the SUM function rather than addition operators, you will
note from Help that SUM ignores True/False values.
 
J

Jerry W. Lewis

Your criteria are not clear. What do you want .599999999 to return?
What about .499999999? What about .400000001? Do you care that if you
round .54 to .5 but .46 to .4 that you will be introducing bias into
your rounded values?

Jerry
 
M

Myrna Larson

I was responding to this statement you made, not to your formula: "For some
reason I have to multiply my boolean values by 1 in order sum them. I haven't
figured out why.".

I don't know why you said that, since you aren't using SUM.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top