Posted to microsoft.public.excel.worksheet.functions
|
|
A rounding oddity
Bernard,
Starting at 3.1, and incrementing by .1, I get
a b b c e f g h
Anyway, instead of
=CHOOSE(MOD(3.8,1)*10+1,"z","a","b","c","d","e","f ","g","h","i")
try
=CHOOSE(ROUND(MOD(3.8,1)*10+1,0),"z","a","b","c"," d","e","f","g","h","i")
I'm sure MOD is affected by binary math, and ....
HTH,
Bernie
MS Excel MVP
"Bernard Liengme" wrote in message
...
To help answer a question on this group, I wanted to convert the decimal
part of a number (in the set 1, 1.1, 1.2, ...... 9.7, 9.8, 9.9 ) to a
letter. Thus 2.1 would yield a, 2.2 would give b.
I experimented with
=CHOOSE(MOD(A1,1)*10+1,"z","a","b","c","d","e","f" ,"g","h","i")
but it did not quite work (for example 3.8 gave 'g' and not 'h')
So I tried
=CHOOSE(MOD(A1*10,10)+1,"z","a","b","c","d","e","f ","g","h","i")
and this worked.
Odd since, at the integer level, =MOD(A1,1)*10+1 and =MOD(A1*10,10)+1 give
the same result.
Using the Evaluate Formula tool (I work with XL 2003) I was unable to see
why my original formula did not work.
=CHOOSE(MOD(3.8,1)*10+1,"z","a","b","c","d","e","f ","g","h","i") yields
=CHOOSE(9,"z","a","b","c","d","e","f","g","h","i") but the next result is
g not h
Very odd!!!
Happy New Year to all
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email
|