i am pretty sure a lot of people in capital market experience this :
use excel formular to convert fraction to decial in 32nd
i know most case we just divide last 2 digits decimal place by 32 for example:
100-160= 100+16/32=100.5
100-200=100+20/32=100.625
but if 3 decimal places : 99-226=99+(22+6/8)/32=99.7109375
how do we convert it to formula in excel , please help!!!!
Assuming a data setup like this where your Bond Prices are in column A and your formula for Decimal Conversion is in column B:
The formula in cell B2 and copied down is:
=LEFT(A2,FIND("-",A2)-1)+(MID(A2&"00",FIND("-",A2)+1,2)+MID(SUBSTITUTE(A2,"+",4)&"000",FIND("-",A2)+3,1)/8)/32
Alternative Using FilterXML() function
Adding a further column B with the following xml conversion
="<t><a>" &SUBSTITUTE(SUBSTITUTE(A2,"+","4"),"-","</a><b>")&"</b></t>"
you can calculate results in a next column via FilterXML() available in Excel 2013+:
=FILTERXML(B2,"//a")+(LEFT(TEXT(FILTERXML(B2,"//b"),"000"),2)+RIGHT(TEXT(FILTERXML(B2,"//b"),"000"),1)/8)/32
tl;tr - one column solution (just for fanatics)
Of course you could also force the xml base into one formula:
=FILTERXML("<t><a>" &SUBSTITUTE(SUBSTITUTE(A2,"+","4"),"-","</a><b>")&"</b></t>","//a") + (LEFT(TEXT(FILTERXML("<t><a>" &SUBSTITUTE(SUBSTITUTE(A2,"+","4"),"-","</a><b>")&"</b></t>","//b"),"000"),2)+RIGHT(TEXT(FILTERXML("<t><a>" &SUBSTITUTE(SUBSTITUTE(A2,"+","4"),"-","</a><b>")&"</b></t>","//b"),"000"),1)/8)/32
Related
I have the following 4 rows and I wish to find the decimal length (aka scale) of that decimal value. Do note that I'm importing all of the decimal data in Excel whose cell is formatted in a "Text" format (hence the trailing zeros even after the decimal values). And I do not want to convert it into decimal. I just need to find the scale of that decimal number.
Decimal Number
Scale (Formula?)
106.520000
2
0.080100
4
15.000010
5
265.000000
0
Been struggling for a very long time now. I'd appreciate any lead on this.
This is what I have tried,
• Formula used in cell B2
=LEN(MID(NUMBERVALUE(A2),FIND(".",A2)+1,255))
You could try:
Formula in B2:
=MAX(LEN(-A2)-LEN(INT(A2))-2,0)
Note: I use a decimal comma but it shouldnt matter for you.
I need to count the numbers of decimals places of a number.
The A1 cell value is:
123456.78.
The formula in B1 is:
=LEN(MOD(A1,1))
The results of MOD(A1,1) is:
0.78
I expected the LEN to be 4 (LEN(0.78)=4).
The Excel formula calculates 17 because the forumula returns:
0.779999999998836
Should I try a different approach? For example looking for the separator char?
=LEN(A1)-FIND(".",A1)
Try this:
=LEN(RIGHT(A1;LEN(A1)-FIND(",";A1)))
A better formula managing a non decimal entry and different decimal separators:
=IF(ISNUMBER(FIND(".";A1));LEN(A1)-FIND(".";A1);IF(ISNUMBER(FIND(",";A1));LEN(A1)-FIND(",";A1)))
I see that the Len function is causing the math function to return the incorrect value for some reason (Len(Mod(123456.78, 1)) is returning 17 not 4, whereas Len(Mod(6.78,1) correctly returns 4).
You can add the TEXT function to your formula to change it to text, with a format of "General" to preserve the decimal precision, before calculating the length: LEN(TEXT(MOD(A1,1), "General")).
For those wanting to use this to calculate the number of decimal places without the leading "0.", simply subtract 2 from the result.
I have 3 numbers in excel.
A1. 498
A2. 899
A3. 5209
I want the numbers as the followings:
B1. 49800
B2. 89900
B3. 52090
I am still finding the solutions via online but most of the resource is discussing about leading zeros.
Please, could you kindly give me any ideas? Thanks.
I hope this formula may be of some use:
=A1 & REPT("0"; 5 - LEN(A1))
Thought this does not set the format of the cell itself (which I doubt can be done as you are changing the value of the cell by adding the zeros)
The formula only works if you are dealing with numbers as text, so you may need to convert them to text in the formula (TEXT(A1; "0") instead of A1)
you can do this one quite easily without VBA - using an IF and the very handy REPT function:
=IF(LEN(H13)<5,H13&REPT(0,5-LEN(H13)),H13)
Essentially - if the length is less than 5 - you repeat 0 up to the amount of times that its missing.
Seems like simple math to me. Essentially you want to shift left (base 10) a certain number of times. We can do this by:
Calculate the ceiling of the base-10 logarithm of the value to get it's "length"
Subtract the result from the target "length" of 5, this is the number of places we want to shift
Take 10 to this power and multiply back by the value.
In other words, where x represents the value in column A you want to transform:
In Excel, this would be expressed as:
=A1*POWER(10,(5-CEILING(LOG10(A1),1)))
I'm trying to convert a formula from excel into a formula for Google spreadsheets but it's not working. The notification I keep getting is:
Matrix value can't be found
The formula converts Letter/lettercombinations into a average grade (number).
=SUM(COUNTIF(C4:C11;$A$55:$A$62)*($C$55:$C$62))/COUNTA(C4:C11)
Where $A$55:$A$62 refers to the cells with the letters:
O
M
M/V
V
V/RV
RV
RV/G
G
and $C$55:$C$62 refers to the numbers that correspond to the letters:
4,5
5
5,5
6
6,5
7
7,5
8
C4:C11 are the cells where the teacher can choose from the different letter/lettercombinations (through validation).
Maybe there is a better way to make these calculations, so if you have any suggestions I would really appreciate it.
You need to enter the formula as a matrix formula, that is, end it with Ctrl-Shift-Return. It'll appear then as {=SUM(COUNTIF(C4:C11;$A$55:$A$62)*($C$55:$C$62))/COUNTA(C4:C11)}. Reason: the formula uses the values in A55...A62 and C55...C62 one after the other to form the conditional sum. To signify this, you make the formula a matrix formula.
I have a spreadsheet (excel 2010) where in column A I have a metric value (2413mm) and in column B I need a formula that will convert 2413mm to show the feet/inches in the following format (7' 11")
I can do this if I use 3 or 4 columns to first convert the 2413 to 7.9', then extract the feet and inches into two separate columns and finally concatenate the separate feet and inches into a final cell.
I'd really like to be able to do all this within one cell.
I notice that Gary's Student's answer will give you decimals in the inches - if you want the answer to the nearest inch try this version
=INT(ROUND(A1*0.03937,0)/12)&"' "&MOD(ROUND(A1*0.03937,0),12)&""""
With data in A1, in B1 enter:
=INT(CONVERT(A1,"mm","ft")) & " '" & 12*(CONVERT(A1,"mm","ft")-INT(CONVERT(A1,"mm","ft"))) & """"
I wrote a User Defined Function to deal with feet and inches once and for all. I've shared the code and a downloadable VBA module here:
https://engineerstoolkit.wordpress.com/2017/03/05/dealing-with-feet-and-inches-in-excel/
If you install that, you can display the result (to any precision you desire) using the formula:
=FtToString(A1/25.4/12) Dividing by 25.4 converts the millimeters to inches, and dividing again by 12 converts it to feet (which is the assumed input for my formula).