View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Bernard Liengme Bernard Liengme is offline
external usenet poster
 
Posts: 4,393
Default If 100.0% display 100%

Numbers in A1 and B1. my percentage is (B1-A1)/A1; Adjust to suit your needs

=IF(MOD((B1-A1)/A1*100,1)<0.00000001,TEXT((B1-A1)/A1,"#%"),TEXT((B1-A1)/A1,"#.#%"))

Note I do not check MOD for zero because of the possibility of round off
errors as with 2 and 4.56
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"jmj713" wrote in message
...
I have a sheet where several numbers are compared and the difference is
displayed in percentage. For instance, if the first number is 1 and the
second number is 2, then the difference is +1 or 100%. The numbers I have
are
much more complex and varied, so my percentage is actually set to display
1
decimal place. But there are some occasions when the percentage is a whole
number, like 100%, and I don't want that trailing zero there. Is that
possible to remove somehow, leaving numbers that are not whole with their
.7
or .2 decimals?