How do I perform a calculation on a 20 digit number in an excel ?

H

Hans Terkelsen

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top