Excel remove Characters past a decimal - excel

I have a large excel file the contains many way-points in Latitude and Longitude in the degree and minutes. My problem is that the numbers can't be rounded and must stay exactly the same, but the last 2 numbers need to be removed (in most cases)
I was wondering if there is a formula that would only allow three characters past the decimal. This is how most my numbers look.
26° 17.82964
However Sometimes they look like this
26° 9.82
I know I can format the cell as a number and set the decimal place to 3, however when I copy and paste it doesn't stay the same.

This formula will truncate (It does not Round) the numbers and give all if less:
=MID(A1,1,FIND(".",A1)+3)
This formula will round, but it will always fill out the numbers to three decimal places (I am aware the OP did not want rounding, this is for others that may want it.):
=LEFT(A1,FIND(" ",A1))&TEXT(ROUND(--MID(A1,FIND(" ",A1),LEN(A1)),3),"0.000")

Related

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).

Function that returns number of significant figures after decimal point in specific formatting

Wondering if anyone knows a function that would return the number of significant figures after a decimal point? And even further how to put that number in a specific formatting?
For example if the number was 27.9834 it would return 0.0001. Or if it was 2.1 it would return 0.1.
You should be able to do this using a LEN and MATCH to get the number of decimal points, then its a simple "^" function to get the decimal place.
Assuming your number is in Cell A1:
=10^-(LEN(A1) - FIND(".",A1))
Just make sure you are showing the right number of significant digits in the result cell or it will just look like zero.
The LEN() counts the number of characters and then you subtract the number of characters from the left to where the decimal is. I think there is an upper limit on the number of decimals that excel can handle, but i don't recall what it is.
Another method might be,
=AGGREGATE(14, 6, POWER(10, -(ROW($1:$16)-1))/(TRUNC(A2, ROW($1:$16)-1)=A2), 1)

Numbers stored as text - when converted to numbers, digits disappear

I have a column of data with numbers stored in text.
The numbers look like this: 735999114002665788
If I select any cell in this column and refer to it with the function =value(), the number shows up as 735999114002665000.
As you can see the last three digits are 0. This happens all the time with numbers this long - but NOT with numbers containing less digits.
Am I trying to convert a number that's too large or what's up? Please help! I've tried every form of text-to-number method with identical results :(
Excel's number precision is 15 digits, which is why you're losing the last three digits when converting your 18 character string
https://support.office.com/en-us/article/excel-specifications-and-limits-1672b34d-7043-467e-8e27-269d656771c3#ID0EBABAAA=Excel_2016-2013
Excel only allows a maximum of 15 digits of precision for each number in a cell. The reason why this number:
735999114002665788
becomes this:
735999114002665000
is because Excel is choosing to retain the 15 most significant digits in the number. This means that the ones, tens, and thousands digits are being tossed out.
By the way, this question has been asked before on SuperUser, and you can read about it here:
https://superuser.com/questions/437764/why-is-excel-truncating-my-16-digit-numbers

Why does excel AVERAGE change when changing the number format of cells?

I've got an Excel sheet which is exhibiting strange behaviour. I have 2 values, followed by an average of those 2 values - simple enough, right?
However, if I change the number format of the top cell from 2 decimal places to 30, I get a different result:
Can anyone explain this? When a cell is formatted to 2 decimal places, does that mean all formulae using this cell are rounding the value to 2 decimal places also?
Check your Excel options (Alt+F,T) for the Advanced ► When calculating this workbook ► Set precision as displayed option. When this is checked, calculation is automatically rounded off to the displayed number of decimals rather than the internal 15 digit floating point precision. It also permanently truncates the raw value to the displayed precision so I am unclear on how you are bouncing between the two average values.
The actual average of 1.6786427146 and 1.73 is 1.7043213573 which is 1.70 when only two decimals are displayed. It would only be through Precision as displayed that 1.6786427146 would actually be converted to 1.68 making the average 1.71.
Turn the option off and the underlying raw value will be stored to a 15 digit floating point precision. The same goes for all internal formula calculations.

Resources