ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Converting Fraction that is in text form into decimal (https://www.excelbanter.com/excel-worksheet-functions/454102-converting-fraction-text-form-into-decimal.html)

Pack

Converting Fraction that is in text form into decimal
 
Import data with fractions like this 44"1/16 so it reads it as text and not number. I need a formula to turn it into decimal numbers so I can use them in equations.

Claus Busch

Converting Fraction that is in text form into decimal
 
Hi,

Am Wed, 6 Jun 2018 14:55:30 +0100 schrieb Pack:

Import data with fractions like this 44"1/16 so it reads it as text and
not number. I need a formula to turn it into decimal numbers so I can
use them in equations.


try:
=LEFT(A1,FIND("""",A1)-1)+MID(A1,FIND("""",A1)+1,FIND("/",A1)-FIND("""",A1)-1)/MID(A1,FIND("/",A1)+1,2)


Regards
Claus B.
--
Windows10
Office 2016

Claus Busch

Converting Fraction that is in text form into decimal
 
Hi,

Am Wed, 6 Jun 2018 18:03:17 +0200 schrieb Claus Busch:

=LEFT(A1,FIND("""",A1)-1)+MID(A1,FIND("""",A1)+1,FIND("/",A1)-FIND("""",A1)-1)/MID(A1,FIND("/",A1)+1,2)


you can also try it with an UDF.
Copy the code into a standard module:

Function Deci(myRng As Range) As Double
Dim varData As Variant
Dim varTmp As Variant

varData = Split(myRng, """")
varTmp = Split(varData(1), "/")
Deci = varData(0) + varTmp(0) / varTmp(1)
End Function

and call the function on the sheet with e.g.

=Deci(A1)


Regards
Claus B.
--
Windows10
Office 2016


All times are GMT +1. The time now is 05:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com