As you can see, fractions don't convert cleanly to decimals. There is a range. Rather than using a case statement, I would create a table that includes
StringFraction
LowDecimal
HighDecimal
SaveAsDecimal
I think Pat's hit the nail on the head as usual!
I am also guilty of a rookie mistake in not explaining the problem properly!
The goal is a table of measurements in centimetres and feet and inches, with a key value stored which will be centimetres. This field will provide the basis for any calculations.
On the form the user will have an option button to select the display of the measurement in either centimetres or feet and inches.
I've got all this working, both lists, the feet and inches, and pounds and stones, and the switch-over from decimal to English. However the feet and inch list really needs quarter inches added to it, so that it doesn't have repeating values that are exactly the same.
I think the function provided by R Hicks will cure this...
I've done all sorts of calculations in a spreadsheet for both, converting centimetres to feet and inches and kilograms to stones and pounds.
I have posted my current Google Spreadsheet, for anyone to to play around with, if you have the time and inclination.
Basically you use modulus to handle the remainders, but it doesn't seem to matter how small a fraction you get down to, you can't get a nice list of matching heights. The weights are OK though.
I'm drawn to the case statement with as Pat described, ranges.
I'm not convinced it's impossible to do with a calculation, I think there's something I don't understand about the calculation itself. I reckon a correctly constructed function would probably do it.
Again, as Pat said they need to go in a table, in fact I already have them in a table, but I have numerous entries where I have the centimetres increasing by 1cm and being matched to exactly the same feet and inch measurement several times, usually in groups of 2 or 3. I reckon the solution is to provide quarter-inch measurements and I think that would sort out the problem. but it had me scratching my head somewhat!