![]() Hundreds = ConvertHundreds(Right(myNumber, WorksheetFunction.Min(3, Len(myNumber)))) MyNumber = Trim(Left(myNumber, DecimalPlace - 1)) If Len(myNumber) = 0 Or Val(myNumber) = 0 Or IsNumeric(myNumber) = False Then Private Function NumberINTtoINDtext(ByVal myNumber) If Val(myNumber) = 0 Then NumberINTtotext = "ZERO" MyNumberInt = Left(myNumberInt, Len(myNumberInt) - 3) ' Remove last 3 converted digits from MyNumber. If Temp "" Then myNumberInteger = Temp & Place(Count) & myNumberInteger Temp = ConvertHundreds(Right(myNumberInt, 3)) ' Convert last 3 digits of MyNumber to English GBP. ' Convert MyNumber to a string, trimming extra spaces. If Len(myNumber) = 0 Or IsNumeric(myNumber) = False Then Private Function NumberINTtotext(ByVal myNumber) Private Function ConvertDigit(ByVal MyDigit) Result = Result & ConvertDigit(Right(MyTens, 1)) Private Function ConvertTens(ByVal MyTens) Result = Result & ConvertDigit(Mid(myNumber, 3)) ' If not, then convert the ones place digit. Result = Result & ConvertTens(Mid(myNumber, 2)) ' Do we have a tens place digit to convert? Result = ConvertDigit(Left(myNumber, 1)) & " Hundred " ' Do we have a hundreds place digit to convert? Private Function ConvertHundreds(ByVal myNumber) PAISE = " & " & PAISE & " " & FracSYMPlural PAISE = " & " & FracSYMPlural & " " & PAISE If Val(myNumber) = 0 Then TextCurrency = CurrSYMSingular & " " & "ZERO" ![]() TextCurrency = NumberINTtotext(myNumberInt) & " POINT " & NumberFRACtotext(myNumber) TextCurrency = NumberINTtoINDtext(myNumberInt) TextCurrency = NumberINTtoINDtext(myNumberInt) & " POINT " & NumberFRACtotext(myNumber) MyNumberFrac = Trim(Mid(myNumber, DecimalPlace + 1)) MyNumberInt = Trim(Left(myNumber, DecimalPlace - 1)) OMR).ĭim Temp, myNumberInt, myNumberFrac, DecimalPlace, Count, RUPEEs, PAISE 'Refer to following webpage for fractional units and sizes of different currencies Optional FracSYMSingular = "PAISA", Optional FracSYMPlural = "PAISE", Optional TextStyle = 1) Optional CurrSYMSingular = "RUPEE", Optional CurrSYMPlural = "RUPEES", Optional FractionSize = 100, _ Function TextCurrency(ByVal myNumber, Optional NumberSystem = 2, Optional Currenc圜onversion = "YES", _ Main function and other private functions supporting it are as below. Optional FracSYMPlural = DEFAULT Value = "PAISE",įor example Cents for US DOLLAR, Paise for Indian Rupee for multiple units of currency fraction, Default Value Paiseġ for CurrencySYM and Amount, 2 for Amount and CurrencySYM, Default Value 1" Optional FracSYMSingular = DEFAULT Value = "PAISA",įor example Cent for US DOLLAR, Paisa for Indian Rupee for one unit of currency fraction, Default Value Paisa Optional FractionSize = DEFAULT Value = 100, _įor example 100 for one INR = 100 Paise, one USD = 100 Cents, Default value 100 Optional CurrSYMPlural = DEFAULT Value = "RUPEES",įor example USDs or US DOLLARs, INRs or Indian Rupees for multiple units of currency, Default Value Rupees 'for example USD or US DOLLAR, INR or Indian Rupee for one unit of currency, Default Value Rupee Optional CurrSYMSingular = DEFAULT Value = "RUPEE", Yes to convert the number to currency, Default Value Yes. Optional Currenc圜onversion = DEFAULT Value = "YES", _ Optional NumberSystem = DEFAULT Value = 2,ġ for International (Thousand,Million,Billion), 2 for Indian (Thousand,Lakh,Crore), Default Value 1 MyNumber = Number to be converted to text Kindly suggest any modifications required. But the function can be adopted to any currency through suitable parameters making it very flexible. For example, 4556.45 to RUPEES Four Thousand Five Hundred Fifty Six & PAISE Forty Five (Defaults being set to Indian Rupee). Here is a function that can be saved as add in and used as UDF in Microsoft excel to convert a number to text.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |