ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How do I perform a calculation on a 20 digit number in an excel ? (https://www.excelbanter.com/excel-worksheet-functions/242134-how-do-i-perform-calculation-20-digit-number-excel.html)

vaishali

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


Hans Terkelsen

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.




All times are GMT +1. The time now is 02:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com