I would like to convert a set of numbers in standard format (511241) to decimal format (5.11241) on Microsoft Excel 2010. I have tried working through with the decimal in the number format, but it considers the standard format whole numbers. Any suggestions would be gladly welcomed.
If the true value of all the numbers are less than 10, then the divisor will be 10 raised to the power of 1 less than the length of the number. You should be able to write a User Defined Function for that algorithm.
Related
How does excel determine what to number to display? specifically the number of decimal places
for example:
50.98, when stored as a single-precision float is 50.979999542236328125
50.979999 is also stored as the exact same single-precision float
(binary rep. 01000010010010111110101110000101, taken from here: https://www.h-schmidt.net/FloatConverter/IEEE754.html)
when i type 50.98 & 50.979999 into 2 cells, change format to number, and extend out the decimal places using the formatting button
it represents them exactly as 50.98 & 50.979999, as i originally typed.
how is that working? is excel storing the exact text i typed and not (directly) storing the float data type at all?
if it stores it as a double, how does it preserve the exact precision i originally typed in that case?
i can't find documentation outlining how this works.
Note its not causing me any problems, i just need an explanation for differences in how excel displays vs calculations based on those values.
it represents them exactly as 50.98 & 50.979999, as i originally typed.
Excel is padding with zeros after 15 significant decimal digits.
The internal number is encoded with a high enough binary precision such that limiting output to 15 deimcal places, the original typed in decimal values appear to be exactly that.
=2/3 is an informative example showing this limit and exposing the binary internals by carefully extracting out a bit at a time.
As displayed in one cell, decimal output rounds to 15 places, padding with zero after that.
0.66666666666666700000000
The below does a binary conversion of =2/3 and forms 0.101010101010101010101010101010101010101010101010101012, exactly what is expected if Excel used a binary64. (Below)
OP's observations are consistent with using binary64 and rounding output as decimal text to 15 significant digits.
Cell A3: =FLOOR(B2*A$1,1), Cell B3 = =B2*A$1 - A3
Hypothesis: When displaying a number, Excel first converts a number to a decimal numeral with at most 15 significant digits even if more are requested. If additional digits are requested, they are filled in as zeros. (In addition, Excel may apply other alterations depending on context.)
In Microsoft Excel 2008 for Mac, I entered =1+22*POWER(2,-52) in A1 and =1+23*POWER(2,-52) in A2. Using IEEE-754 binary64, these should generate the numbers 1.000000000000004884981308350688777863979339599609375 and 1.0000000000000051070259132757200859487056732177734375. Entering =A1-1 and =A2-1 in B1 and B2 and setting these to Number format with 30 decimal places shows “0.000000000000004884981308350690” and “0.000000000000005107025913275720”, which is consistent with IEEE-754 binary64. So we have some assurance the numbers above were indeed generated and stored in Excel.
Setting A1 and A2 to Number format with 20 decimal places shows “1.00000000000000000000” and “1.00000000000001000000”.
Clearly, if Excel were displaying the actual numbers with 20 decimal places, it would show “1.000000000000004885” and “1.000000000000005107”. It does not. The display we see is consistent with converting the numbers using 15 decimal digits (significant digits, not just those after the decimal point) and then padding with zeros.
Converting 50.98 to the IEEE-754 binary64 format yields 50.97999999999999687361196265555918216705322265625. Displaying this with 15 decimal digits yields 50.9800000000000.
I'm using excel to sum up all the hours that my team worked on. However, the hours are displayed as 31.60 or 31.70
I want to convert 31.60 = 32 or 31.70 = 32.10. Just need the numbers, no formatting text.
You could take the decimal part like A1-INT(A1) where A1 is your data and divide it by 0.6. The integer result that you get is added to the integer part of your cell. And finally add the rest of the division. I didn't manage to keep it short.
=INT(A1)+ INT((A1-INT(A1))/0.6)+ MOD((A1-INT(A1)),0.6)
I'm creating a simple spreadsheet to calculate some betting odds and keeping track of my wins/losses
when I put fractional odds in one column Excel converts some of them to whole numbers (i.e. the ones that are 1/1, 2/1, etc where it does not do it for odds like 4/11, 7/2, etc.
Is there a way of turning this off?
Please note that some of the top heave fractions (11/2, 11/10 etc) get put into whole numbers such as 5 1/2 etc! And I do not want this to occur either
I've tried the Custom formatting of the cells but all of the denominators will inevitably be different, so having something like ??/28 won't work for me
EDIT:
This was solved using the custom format ??/?? and simply removeing the # that was at the front of the custom cell format dialog box
You simply need to change the cell format; you want to use ???/???. This will make Excel represent any decimal number to the closest fraction approximation it can find using the specified numerator and denominator significant digits (number of ? in the format string)
If the cell input is directly a fraction, it will reduce it if possible but always keeping the fraction format.
Examples:
= .10 will be converted to 1/10
= 0.1231 will be converted to 81/658 (supossing ???/??? format is used).
= 10/100 will be converted to 1/10
= 11/12 will remain as 11/12 as no reduction is possible.
= 1/1 will remain as 1/1
etc.
The behavior you are describing is becuase you are using one of Excel's default fraction formats which are all similar to # ???/??? (take note of the leading #). This format will reduce integral values to the non fractional part.
You could use text format for the cells with the odds, and then the VALUE function in any calculations you need to do with them
I put an "if" function to give me no decimals if result is >200, if not to give me 1 decimal. It works great, unless the result's decimal is .0, then it doesn't show me my decimal. How can I force the decimal to show?
Here is my function: =IF($E$13>200,ROUND($E$13,0),ROUND($E$13,1))
If representing the number as text is acceptable, the following will solve your problem:
=IF($E$13>200,ROUND($E$13,0),IF(ROUND($E$13,0)=ROUND($E$13,1),CONCATENATE(ROUND($E$13,0),".0"),ROUND($E$13,1)))
If you need to use your number in future calculations, be sure to use the original number, which can be obtained via ROUND($E$13,1).
How do I tell excel I want the first two digits to be assummed to be decimal places using NNNNNNNNNNN format? thx
I'm trying to use excel format to convert 29.00 to following:
00000002900
but it keeps look like the following:
00000000029 // how do I get the 29 to move up by two digits like the first one????
I'm using custom format in excel of "00000000000" but that is not working. thx
First off, your custom format should be "00000000000" instead of "NNNNNNNNNNN" if I'm not mistaken.
If you don't want to see a decimal place you can store all your values in cents instead of dollars (multiply by 100) and use "00000000000". If you want to still use dollars and don't mind a decimal point use "000000000.00"
I don't think you can do that with a Format mask as the only way would be to actually modify the underlying value.
you could use; =TEXT(A1*100,"00000000000")