View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bernard Liengme Bernard Liengme is offline
external usenet poster
 
Posts: 4,393
Default A rounding oddity

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