Certain fractions being calculated in excel 2013 - excel

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

Related

Excel 2007, inconsistent logical OR response

Regarding Excel 2007 (though it may pertain to other versions):
I want to apply Excel Data Validation to manually inputted data. In this particular case, the input is of the form NN.nnnnh, where the digit "h" is a "half-digit". That is, it can either be 0 or 5.
The spread-sheet converts land-surveying that is manually entered in the form of Feet, Inches, and 16ths of an inch, into decimal feet
The function of the half-digit is to allow the optional higher-precision to 1/32nd of an inch.
For example:
43.0913 is the raw entry for 43 feet, nine inches, and 13/16ths of an inch.
Now, by adding the half-digit in the fifth decimal place, a precision of 1/32" can be expressed.
For example:
27.08135 is the manual entry for 27 feet, 08 inches, and (13.5/16=) 27/32nds of an inch.
The raw input NN.nnnnh is decomposed and converted into feet as a decimal number, using Excel TRUNC function. This manner of conversion is analogous to the more familiar conversion of angles entered as D˚M'S", into DD.dddddd).
I want to assure that the 5th decimal place, manually entered, is ONLY Zero or 5.
I can separately apply logical tests to determine if the fifth-decimal entry is Zero, or 5.
But, when I combine those separate logical tests using the =IF(OR( structure, I get inconsistent results IFF the manually-entered data has an integer value (i.e., in the NN.nnnnh format, any length of just one foot or greater, manually entered as >= 1.00000). Unless I undertake the surveying of table-top architectural scale models, this has serious limitations !!!
I have attached an example spreadsheet to illustrate the formulae used and the results. If anybody can shed some light on this, it would be appreciated.
(If there is a way to simply Attach a *.xlsx example....please let me know. I had intended to do this, and then discovered that it seems to be impossible!)
Use MROUND to test if the number is the same:
=A1=MROUND(A1,0.00005)

Format integers as fraction

I have a list of fractions in Excel which I want to format as fractions, including integers. However, by default Excel formats integers as integers which is understandable.
Is there any way to force Excel to format, say, 4/4 as 4/4 instead of 1?
I need it to be stores as values and not as text, so '4/4 wont work. As I need to average a bunch of values from it afterwards.
Apparently I'm the first person ever to take issue with this, because google provides absolutely no help whatsoever :o
Yes, use a custom number format:
?/4
I don't believe what you are trying to accomplish is doable outright, as fractions are really division problems. However, with some formula trickery, you may be able to get something that will work for you.
If you place '7/8 in cell A1 and then use the following formula in cell B1
=DECIMAL(MID(A1,1,FIND("/",A1,1)-1),10)/DECIMAL(MID(A1,FIND("/",A1,1)+1,LEN(A1)),10)
The cell will display the decimal value of the "fraction", in this case 0.875 allowing you to change the denominator at will and still perform math functions.
This works because the formula slices up the "fraction" stored as text and converts it to a number and performs the math.

Excel: number entered vs number displayed vs number stored in memory

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.

Use MS Excel to round one number to 2 significant figures, then update another cell to match the number of decimal places

I am trying to use Microsoft Excel to format a large set of data. The data is all in decimal format and the results are paired so that we have 2 values per record. The first value is a Mass in grams, and the second value is the Uncertainty of that mass also in grams.
For example:
SampleName = S1, Mass(g) = 28.695, Uncertainty(g) = 1.601133
What I need to do is have the "Uncertainty" update to 2 significant figures, then depending on the value returned, have the "Mass" update to match the number of decimal places (or whole numbers) that the "Uncertainty" now is.
e.g.
if Uncertainty became 1.6, then Mass should become 28.6
if Uncertainty became 1.61, then Mass should become 28.69
if Uncertainty became 2, then Mass should become 29
I have attempted to use the ROUND function on the "Uncertainty" cell but then I don't know how to make the "Mass" cell update accordingly.
I have tried the following 2 ROUND formulas, which both seem to work for rounding the "Uncertainty":
=ROUND(A1,2-INT(LOG(ABS(A1))))
=ROUND(A1, 2)
Any help would be much appreciated.
This formula counts the number of decimal places in a given cell:
=LEN(RIGHT(A1,LEN(A1)-FIND(".",A1)))
So you could use this in your Round formula where you specify the number of decimals:
=ROUND(A1, LEN(RIGHT(A1,LEN(A1)-FIND(".",A1))))
To round to 2 significant figures you can use something like this:
=ROUND(uncertainty,2-(1+INT(LOG10(ABS(number)))))
To round (eg) B2 based on number of decimals in (eg) D2:
=ROUND(B2,IFERROR(LEN(RIGHT(D2,LEN(D2)-FIND(".",D2))),0))

Why am I obtaining this strange value multiplying 2 number having different format using Excel?

I am very new to Excel and I have a problem with a simple multiplication (I know, it is depressing but I'm stuck).
I have to multiply the numeric content of 2 cells (these value are calculated using 2 different formulas).
The problem is that it seems that these 2 cells contain numeric values having different format and I obtain a strange result.
Infact I have:
1) The K3 cell containing this value: 0,0783272400
2) The K6 cell containing this value: 728.454911165
In another cell I simply do:
=K3*K6
but now I am obtaining this nonsense value: 57.057.862.655,9996000000
I think that the problem could be related to the fact that the first one use the , do divide integer section and decimal section, and in the other one I am using . to divider the integer section and decimal section.
How can I correctly handle this situation?
Format both values as Currency in Excel and forget about the issue.
You are getting it, because the floating point values are not represented differently in many programming languages. In Excel probably the best way to make sure you do not give strange values is to format as Currency.
Or in VBA to use the CDec and to convert to decimal.
Is floating point math broken?
Excel is treating 0,0783272400 as something less than one tenth and 728.454911165 as getting on for one thousand billion. The result is formatted with . for thousands separator and , for decimal separator - and is not nonsensical (though the choice of formatting is).

Resources