Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello All,
There is code available for converting a number to its equivalent English Text. (Like 1= "One") Do any one here have a code to convert numbers to Arabic Language Text? Thanks Abdul |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Abdul,
A lot depends on the word structure in Arabic. For example, I helped someone convert the standard 'number to word' function to Italian, which has different words depending on the level - for example, "unmilione" for 1 million, and "milioni" for multiples. I have copied the code for the Italian conversion below - you would basically need to change each quoted value to the appropriate word in Arabic. (That, I can't help you with.) But if there is additional structure needed in the function, post back, and I can help you with that. The function, as written, is used like =Conversion(A1) where A1 has a number that needs to be converted to words. HTH, Bernie MS Excel MVP Function conversion(inRange As Range) As String conversion = "" n = inRange.Value 'Do Billions bill = n / 1000000000 If Int(bill) 0 Then If Int(bill) = 1 And ((Int(bill) - bill) < 0) Then conversion = "unmiliardo" Else conversion = MakeWord(Int(bill)) & "miliardi" End If End If 'Do millions n = n - Int(bill) * 1000000000 mill = n / 1000000 If Int(mill) 0 Then If Int(mill) = 1 And ((Int(mill) - mill) < 0) Then conversion = "unmilione" Else conversion = conversion & MakeWord(Int(mill)) & "milioni" End If End If 'Do Thousands n = n - Int(mill) * 1000000 thou = n / 1000 If Int(thou) 0 Then If Int(thou) = 1 And ((Int(thou) - thou) < 0) Then conversion = "mille" Else conversion = conversion & MakeWord(Int(thou)) & "mila" End If End If 'Do the rest n = n - Int(thou) * 1000 conversion = conversion & MakeWord(Int(n)) conversion = Application.WorksheetFunction.Proper(Trim(conversi on)) End Function Function MakeWord(inValue As Integer) As String 'Enter the counting words: one, two, three... up to 19 unitWord = Array("", "uno", "due", "tre", "quattro", "cinque", _ "sei", "sette", "otto", "nove", "dieci", "undici", _ "dodici", "tredici", "quattordici", "quindici", "sedici", _ "diciassette", "diciotto", "diciannove") 'enter the decade words - 10, 20, etc. tenWord = Array("", "dieci", "venti", "trenta", "quaranta", "cinquanta", _ "sessanta", "settanta", "ottanta", "novanta") MakeWord = "" n = inValue If n = 0 Then MakeWord = "" End If 'Do the nundreds hund = n \ 100 If hund 0 Then If hund = 1 Then MakeWord = MakeWord & "cento" Else MakeWord = MakeWord & unitWord(hund) & "cento" End If End If n = n - hund * 100 If n < 20 Then ten = n MakeWord = MakeWord & unitWord(ten) & "" Else ten = n \ 10 MakeWord = MakeWord & tenWord(ten) & "" unit = n - ten * 10 MakeWord = Trim(MakeWord & unitWord(unit)) End If MakeWord = Application.WorksheetFunction.Proper(Trim(MakeWord )) End Function "Abdul" wrote in message oups.com... Hello All, There is code available for converting a number to its equivalent English Text. (Like 1= "One") Do any one here have a code to convert numbers to Arabic Language Text? Thanks Abdul |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how to convert arabic numbers to english text format in excel? | Excel Worksheet Functions | |||
convert arbic numbers to arabic text | Excel Worksheet Functions | |||
How do you convert Arabic numbers to English text format? | Excel Discussion (Misc queries) | |||
How can I convert Arabic numbers to English text format in EXCEL | Excel Discussion (Misc queries) | |||
How do I convert Arabic numbers into a spellout text | Excel Worksheet Functions |