View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Larry Levinson Larry Levinson is offline
external usenet poster
 
Posts: 42
Default Data Types help ... Overflow errors

In case anyone finds this, it wasn't actually an overflow error. it
was a divide by zero errror masking as an overflow. thanks.




Larry Levinson wrote:

Overflow ...

"papou" wrote:

Hello Larry
Since one of your variables (guests) used in your calculation is declared as
Long (that's between -2 147 483 648 and 2 147 483 647) I can hardly see this
working because the "result" variable is declared for a lesser value?
Try and declare "result" as long?
HTH
Cordially
Pascal

"Larry Levinson" a écrit dans le message
de news: ...
I have a formula to calculate a percentage,

dim used, guests as Long, result as single
result = (USED / GUESTS)*100

and get the dreaded overflow on data type error on some of the
answers.

I tried double, variant and decimal in the dim statment. decimal
wouldn't even take in the dim.

then, I tried, result = round((USED / GUESTS)*100,1)

but the syntax gets hung up on the parentheses ...

help greatly appreciated.


Larry Levinson
Talking up to the vocal ...
LLevinson*Bloomberg.net
(remove the star etc ....)



Larry Levinson
Talking up to the vocal ...
LLevinson*Bloomberg.net
(remove the star etc ....)


Larry Levinson
Talking up to the vocal ...
LLevinson*Bloomberg.net
(remove the star etc ....)