View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Hans Terkelsen Hans Terkelsen is offline
external usenet poster
 
Posts: 31
Default How do I perform a calculation on a 20 digit number in an excel ?


"vaishali" wrote in message ...

Hi V.

You might use the Decimal datatype in VBA.
It has 28 digit precision.
Suppose you enter your 20 digit numbers in A1 and A2 with ' in front.
The sum is =myplus(A1,A2)
where myplus is your own user defined function

Function myplus$(x$, y$)
myplus = CDec(0) + x + y
End Function

Paste that little function after you have pressed Alt+F11, and chosen Insert Module
The function will then sit in Module1 of the workbook, and can be used from the function list.

Same thing, nearly, with minus, multiply, divide
but multiplications, for instance, will necessarily be rounded.

Hans T.