Function AdarshFrenchToIndian(FrenchNumber As String) As Double '''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Created by : Adarsh Madecha ' Created on : 08 January 2016 ' Version : 1.0 ' Copyright : All rights reserved. ' Website : madrecha.com ' Blog : adarshmadrecha.blogspot.com ' Twitter : @adarshMadrecha ' If you want to share this code, ask that person to visit - adarshmadrecha.blogspot.com '-----------Purpose of this fucntion------------------ ' Using : Fuction accepts only one parameter. You need to provide Number (which is in the french format) in the fucntion. ' ' eg > 8,00,660.78 from > 8.00.660,78 ' ' eg > 99,80,780.34 from > 99.80.780,34 ' ' eg > 3489.898 from > 3489,8980 '''''''''''''''''''''''''''''''''''''''''''''''''''''' 'define tempText Dim tempText As String ' Clean and Trim tempText = Application.WorksheetFunction.Clean(FrenchNumber) tempText = Application.WorksheetFunction.Trim(tempText) ' Delete . and Space tempText = Replace(tempText, " ", "") tempText = Replace(tempText, ".", "") 'Replace , with . tempText = Replace(tempText, ",", ".") 'retrun value AdarshFrenchToIndian = CDbl(tempText) End Function
Labels: Excel, Excel Tips