Quote:
Originally Posted by ArviLaanemets
there is a workaround for 15-number limit. [....] 1. Divide the number to 2 parts [....] P.e. to make calculations with integers like 123456789012345678 enter it as 123456789 and 12345678
|
Not sure what you have in mind, because you neglected to show a complete example of how you would combine them later in a calculation, if that is your intent.
(Not sure that is Jo's intent, anyway.)
There is no getting around the fact that Excel stores numeric values as 64-bit binary floating-point, and the precision is limited to 53 consecutive powers of 2 ("bits") times a binary exponential factor.
That limits any and all attempts to combine your terms into an accurate integer to
any integer that is 2^53 or less, and to only
some integers greater than 2^53.
In your example of representing 123456789012345678 with integers 123456789
0 (corrected) in A1 and 12345678 in A2, the numeric value must eventually become 123456789012345678, which we might write =A1*1E8+A2. The exact decimal presentation of the resulting binary value is 1234567890123456
80.
(In the old days, we would write multiprecision algorithms that used integer parts that were limited to 16 bits. Much easier to do in assembly language, IMHO. But I dare say the mathematics are beyond the ability of most programmers today, not to mention the casual user.)
That is better than 123456789012345000 (actually 12345678901234
4992 after binary conversion), which we get if we enter it manually. But it is still not 1234567890123456
78.
(PS.... The close similarity of 1234567890123456
80 is coincidence. Here's another example: 6118447641 and 26275648 combine to be 611844764126275
648. The exact decimal presentation of the binary value is 611844764126275
584.)
And equally important: Excel will
display the numeric value as 12345678901234
6000, which I suspect Jo would dislike.
I think this is a distraction. Jo seems content with entering the large "number" as text. She just wanted to know how. I was merely noting that your suggest to enter the number first, change the cell format to Text, then press f2 Enter would not work because the excess precision is already lost.
Jo hit upon the correct solution herself: set the cell format to Text first.
Quote:
Originally Posted by ArviLaanemets
2. Design formulas (or user-defined functions) for mathematical operations with such number pairs
|
No need to split "numbers". Just enter the complete number as text. If we can bother to write 1234567890 and 12345678 into separate cells, we could simply write '123456789012345678 (note the leading apostrophe) or ="123456789012345678", if not set the cell format to Text.
There are VBA data types that work with more precision, notably type Decimal and the CDec function. But the result will be converted to 64-bit binary floating-point if it is stored as a number in Excel. To preserve the precision, we
must store the result as text.
No need to reinvent the wheel. There are add-ons that provide a library of functions that do just that.
But the point is: the result is text. And again, any attempt to convert the text to a numeric value in Excel will be faced with the 64-bit binary floating-point limits noted above and in my previous posting.