Ugrás a tartalomra

Hogyan lehet gyorsan konvertálni a számokat angol szavakra az Excelben?

Ha van egy munkalapon egy numerikus értékekkel rendelkező oszlop, és most ezeket az egyenértékű angol szavakra vagy angol pénznemű szavakra kell rendezni, az alábbi képernyőkép szerint. Itt arról fogok beszélni, hogyan lehet gyorsan és egyszerűen megváltoztatni a számokat angol szavakra.

Számok konvertálása angol szavakra a Felhasználó által definiált funkcióval

Számok konvertálása pénznem szavakra a Felhasználó által definiált funkcióval

Konvertálja a számokat valuta szavakká egy hasznos funkcióval


Számok konvertálása angol szavakra a Felhasználó által definiált funkcióval

Nincsenek olyan funkciók vagy képletek, amelyek segíthetnek a feladat közvetlen megoldásában az Excel programban, de a befejezéséhez létrehozhat egy felhasználó által definiált függvényt. Kérjük, tegye a következőket:

1. Tartsa lenyomva a ALT + F11 gombokat, és ez megnyitja a Microsoft Visual Basic for Applications ablak.

2. Kattints betétlap > Modulok, és illessze be a következő kódot a Modul ablak.

Function NumberstoWords(ByVal MyNumber)
'Update by Extendoffice
Dim xStr As String
Dim xFNum As Integer
Dim xStrPoint
Dim xStrNumber
Dim xPoint As String
Dim xNumber As String
Dim xP() As Variant
Dim xDP
Dim xCnt As Integer
Dim xResult, xT As String
Dim xLen As Integer
On Error Resume Next
xP = Array("", "Thousand ", "Million ", "Billion ", "Trillion ", " ", " ", " ", " ")
xNumber = Trim(Str(MyNumber))
xDP = InStr(xNumber, ".")
xPoint = ""
xStrNumber = ""
If xDP > 0 Then
xPoint = " point "
xStr = Mid(xNumber, xDP + 1)
xStrPoint = Left(xStr, Len(xNumber) - xDP)
For xFNum = 1 To Len(xStrPoint)
xStr = Mid(xStrPoint, xFNum, 1)
xPoint = xPoint & GetDigits(xStr) & " "
Next xFNum
xNumber = Trim(Left(xNumber, xDP - 1))
End If
xCnt = 0
xResult = ""
xT = ""
xLen = 0
xLen = Int(Len(Str(xNumber)) / 3)
If (Len(Str(xNumber)) Mod 3) = 0 Then xLen = xLen - 1
Do While xNumber <> ""
If xLen = xCnt Then
xT = GetHundredsDigits(Right(xNumber, 3), False)
Else
If xCnt = 0 Then
xT = GetHundredsDigits(Right(xNumber, 3), True)
Else
xT = GetHundredsDigits(Right(xNumber, 3), False)
End If
End If
If xT <> "" Then
xResult = xT & xP(xCnt) & xResult
End If
If Len(xNumber) > 3 Then
xNumber = Left(xNumber, Len(xNumber) - 3)
Else
xNumber = ""
End If
xCnt = xCnt + 1
Loop
xResult = xResult & xPoint
NumberstoWords = xResult
End Function
Function GetHundredsDigits(xHDgt, xB As Boolean)
Dim xRStr As String
Dim xStrNum As String
Dim xStr As String
Dim xI As Integer
Dim xBB As Boolean
xStrNum = xHDgt
xRStr = ""
On Error Resume Next
xBB = True
If Val(xStrNum) = 0 Then Exit Function
xStrNum = Right("000" & xStrNum, 3)
xStr = Mid(xStrNum, 1, 1)
If xStr <> "0" Then
xRStr = GetDigits(Mid(xStrNum, 1, 1)) & "Hundred "
Else
If xB Then
xRStr = "and "
xBB = False
Else
xRStr = " "
xBB = False
End If
End If
If Mid(xStrNum, 2, 2) <> "00" Then
xRStr = xRStr & GetTenDigits(Mid(xStrNum, 2, 2), xBB)
End If
GetHundredsDigits = xRStr
End Function
Function GetTenDigits(xTDgt, xB As Boolean)
Dim xStr As String
Dim xI As Integer
Dim xArr_1() As Variant
Dim xArr_2() As Variant
Dim xT As Boolean
xArr_1 = Array("Ten ", "Eleven ", "Twelve ", "Thirteen ", "Fourteen ", "Fifteen ", "Sixteen ", "Seventeen ", "Eighteen ", "Nineteen ")
xArr_2 = Array("", "", "Twenty ", "Thirty ", "Forty ", "Fifty ", "Sixty ", "Seventy ", "Eighty ", "Ninety ")
xStr = ""
xT = True
On Error Resume Next
If Val(Left(xTDgt, 1)) = 1 Then
xI = Val(Right(xTDgt, 1))
If xB Then xStr = "and "
xStr = xStr & xArr_1(xI)
Else
xI = Val(Left(xTDgt, 1))
If Val(Left(xTDgt, 1)) > 1 Then
If xB Then xStr = "and "
xStr = xStr & xArr_2(Val(Left(xTDgt, 1)))
xT = False
End If
If xStr = "" Then
If xB Then
xStr = "and "
End If
End If
If Right(xTDgt, 1) <> "0" Then
xStr = xStr & GetDigits(Right(xTDgt, 1))
End If
End If
GetTenDigits = xStr
End Function
Function GetDigits(xDgt)
Dim xStr As String
Dim xArr_1() As Variant
xArr_1 = Array("Zero ", "One ", "Two ", "Three ", "Four ", "Five ", "Six ", "Seven ", "Eight ", "Nine ")
xStr = ""
On Error Resume Next
xStr = xArr_1(Val(xDgt))
GetDigits = xStr
End Function

3. Mentse el és zárja be ezt a kódot, és lépjen vissza a munkalapra, egy üres cellába írja be ezt a képletet = Szám szavakra (A2)( A2 az a cella, amelyet a szám angol nyelvűvé kell konvertálni), lásd a képernyőképet:

4. Ezután nyomja meg a gombot belép gombot, majd válassza ki a C2 cellát, majd húzza a kitöltő fogantyút arra a tartományra, amelyikbe ezt a képletet be kívánja állítani. Az összes numerikus értéket a megfelelő angol szavakká alakították át.

Megjegyzések: Ez a kód csak egész számok esetén működik, de nem vonatkozik a tizedes számokra.


Számok konvertálása pénznem szavakra a Felhasználó által definiált funkcióval

Ha a számokat angol pénznemre kívánja konvertálni, akkor alkalmazza az alábbi VBA kódot.

1. Tartsa lenyomva a ALT + F11 gombokat, és ez megnyitja a Microsoft Visual Basic for Applications ablak.

2. Kattints betétlap > Modulok, és illessze be a következő kódot a Modul ablak.

Function SpellNumberToEnglish(ByVal pNumber)
'Update by Extendoffice
Dim Dollars, Cents
arr = Array("", "", " Thousand ", " Million ", " Billion ", " Trillion ")
pNumber = Trim(Str(pNumber))
xDecimal = InStr(pNumber, ".")
If xDecimal > 0 Then
    Cents = GetTens(Left(Mid(pNumber, xDecimal + 1) & "00", 2))
    pNumber = Trim(Left(pNumber, xDecimal - 1))
End If
xIndex = 1
Do While pNumber <> ""
    xHundred = ""
    xValue = Right(pNumber, 3)
    If Val(xValue) <> 0 Then
        xValue = Right("000" & xValue, 3)
        If Mid(xValue, 1, 1) <> "0" Then
            xHundred = GetDigit(Mid(xValue, 1, 1)) & " Hundred "
        End If
        If Mid(xValue, 2, 1) <> "0" Then
            xHundred = xHundred & GetTens(Mid(xValue, 2))
        Else
            xHundred = xHundred & GetDigit(Mid(xValue, 3))
        End If
    End If
    If xHundred <> "" Then
        Dollars = xHundred & arr(xIndex) & Dollars
    End If
    If Len(pNumber) > 3 Then
        pNumber = Left(pNumber, Len(pNumber) - 3)
    Else
        pNumber = ""
    End If
    xIndex = xIndex + 1
Loop
Select Case Dollars
    Case ""
        Dollars = "No Dollars"
    Case "One"
        Dollars = "One Dollar"
    Case Else
        Dollars = Dollars & " Dollars"
End Select
Select Case Cents
    Case ""
        Cents = " and No Cents"
    Case "One"
        Cents = " and One Cent"
    Case Else
        Cents = " and " & Cents & " Cents"
End Select
SpellNumberToEnglish = Dollars & Cents
End Function
Function GetTens(pTens)
Dim Result As String
Result = ""
If Val(Left(pTens, 1)) = 1 Then
    Select Case Val(pTens)
        Case 10: Result = "Ten"
        Case 11: Result = "Eleven"
        Case 12: Result = "Twelve"
        Case 13: Result = "Thirteen"
        Case 14: Result = "Fourteen"
        Case 15: Result = "Fifteen"
        Case 16: Result = "Sixteen"
        Case 17: Result = "Seventeen"
        Case 18: Result = "Eighteen"
        Case 19: Result = "Nineteen"
        Case Else
    End Select
Else
Select Case Val(Left(pTens, 1))
    Case 2: Result = "Twenty "
    Case 3: Result = "Thirty "
    Case 4: Result = "Forty "
    Case 5: Result = "Fifty "
    Case 6: Result = "Sixty "
    Case 7: Result = "Seventy "
    Case 8: Result = "Eighty "
    Case 9: Result = "Ninety "
    Case Else
End Select
Result = Result & GetDigit(Right(pTens, 1))
End If
GetTens = Result
End Function
Function GetDigit(pDigit)
Select Case Val(pDigit)
    Case 1: GetDigit = "One"
    Case 2: GetDigit = "Two"
    Case 3: GetDigit = "Three"
    Case 4: GetDigit = "Four"
    Case 5: GetDigit = "Five"
    Case 6: GetDigit = "Six"
    Case 7: GetDigit = "Seven"
    Case 8: GetDigit = "Eight"
    Case 9: GetDigit = "Nine"
    Case Else: GetDigit = ""
End Select
End Function

3. Mentse el ezt a kódot, és menjen vissza a munkalapra, egy üres cellába írja be ezt a képletet = SpellNumberToEnglish (A2)( A2 az a cella, amelyet a szám angol nyelvű pénznemre kíván konvertálni), majd húzza lefelé a kitöltő fogantyút azokra a cellákra, amelyeken alkalmazni kívánja ezt a képletet. Az összes szám angol nyelvű szavakra lett megírva, lásd a képernyőképet:


Konvertálja a számokat valuta szavakká egy hasznos funkcióval

A fenti kód kissé problémás az Excel kezdők számára, itt bemutatok egy hasznos funkciót, Kutools az Excel számára's Számok szavakig, ezzel a segédprogrammal gyorsan megírhatja a számokat angol szavakra vagy pénznemekre.

Tipp:Ennek alkalmazásához Számok szavakig funkció, először is le kell töltenie a Kutools az Excel számára, majd gyorsan és egyszerűen alkalmazza a funkciót.

Telepítése után Kutools az Excel számára, kérjük, tegye a következőket:

1. Válassza ki az átalakítani kívánt számok listáját, majd kattintson a gombra Kutools > Tartalom > Számok szavakig, lásd a képernyőképet:

2. Az Számok pénznem szavakra párbeszédpanelen jelölje be Angol lehetőség a Nyelvek listamezőbe, majd kattintson a gombra Ok gombra kattintva láthatja, hogy az összes szám angol nyelvű szavakra van írva:

tippek: Ha szeretné megkapni az angol szavakat, ellenőrizze a Nem átszámítva pénznemre jelölőnégyzetet a Opciók szakasz, lásd a képernyőképeket:

Kattintson a Kutools for Excel letöltéséhez és az ingyenes próbaverzióhoz most!

A legjobb irodai hatékonyságnövelő eszközök

🤖 Kutools AI Aide: Forradalmasítsa az adatelemzést a következők alapján: Intelligens végrehajtás   |  Kód létrehozása  |  Hozzon létre egyéni képleteket  |  Adatok elemzése és diagramok létrehozása  |  A Kutools funkciók meghívása...
Népszerű szolgáltatások: Ismétlődések keresése, kiemelése vagy azonosítása   |  Üres sorok törlése   |  Oszlopok vagy cellák kombinálása adatvesztés nélkül   |   Kerek Formula nélkül ...
Szuper keresés: Több kritérium VLookup    Többértékű VLookup  |   VLookup több munkalapon   |   Fuzzy Lookup ....
Speciális legördülő lista: Gyors legördülő lista létrehozása   |  Függő legördülő lista   |  Többszörösen válassza ki a legördülő listát ....
Oszlopkezelő: Adjon meg egy adott számú oszlopot  |  Oszlopok mozgatása  |  Kapcsolja be a Rejtett oszlopok láthatósági állapotát  |  Tartományok és oszlopok összehasonlítása ...
Kiemelt funkciók: Rács fókusz   |  Design nézet   |   Nagy Formula bár    Munkafüzet és lapkezelő   |  Erőforrás-könyvtár (Auto szöveg)   |  Dátumválasztó   |  Kombinálja a munkalapokat   |  Cellák titkosítása/dekódolása    E-mailek küldése listánként   |  Szuper szűrő   |   Speciális szűrő (félkövér/dőlt/áthúzott szűrés...) ...
A 15 legjobb eszközkészlet12 szöveg Eszközök (Szöveg hozzáadása, Karakterek eltávolítása,...)   |   50 + Táblázatos Típusai (Gantt-diagram,...)   |   40+ Praktikus képletek (Számolja ki az életkort a születésnap alapján,...)   |   19 beszúrás Eszközök (Helyezze be a QR-kódot, Kép beszúrása az útvonalból,...)   |   12 Átalakítás Eszközök (Számok szavakig, Valuta átváltás,...)   |   7 Egyesítés és felosztás Eszközök (Haladó kombinált sorok, Hasított sejtek,...)   |   ... és több

Töltsd fel Excel-készségeidet a Kutools for Excel segítségével, és tapasztald meg a még soha nem látott hatékonyságot. A Kutools for Excel több mint 300 speciális funkciót kínál a termelékenység fokozásához és az időmegtakarításhoz.  Kattintson ide, hogy megszerezze a leginkább szükséges funkciót...

Leírás


Az Office lap füles felületet hoz az Office-ba, és sokkal könnyebbé teszi a munkáját

  • Füles szerkesztés és olvasás engedélyezése Wordben, Excelben és PowerPointban, Publisher, Access, Visio és Project.
  • Több dokumentum megnyitása és létrehozása ugyanazon ablak új lapjain, mint új ablakokban.
  • 50% -kal növeli a termelékenységet, és naponta több száz kattintással csökkenti az egér kattintását!
Comments (66)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hello dear.
It work good but after reopening the file. function is not working. what is the reason....? it can be solved or copy paste every time while open the same file.
This comment was minimized by the moderator on the site
Hello, Sheraz,
To keep the code work correctly, you should save the workbbok as Excel Macro-Enabled Workbook format. This file format will save the vba code.
Please try, hope it can help you!
This comment was minimized by the moderator on the site
Thank you for sharing such a wonderful program.

Kindly advise, I want to convert figures into words like "515,253.33" to show as Five Hundred Fifteen Thousand Two Hundred Fifty Three and Cents Thirty Three Only. Also it should not show "Dollars"
Warm regards,
Khozema
This comment was minimized by the moderator on the site
HI SIR/MADAM,

ITS WORKING GOOD BUT I NEED ONE THINK TO ADD "LAKS & CROSE" HOW TO ADD PLESE ATTACHED THIS CODE TO ME THANKS
This comment was minimized by the moderator on the site
Thank you so much... it works awesome
This comment was minimized by the moderator on the site
What needs to be changed if i want to make the decimal place into this "and ___/100"? For examples, instead of "ONE MILLION FOUR HUNDRED THIRTY THOUSAND TWO HUNDRED FORTY FIVE PESOS AND EIGHTY ONE CENTS", i want it to be like "ONE MILLION FOUR HUNDRED THIRTY THOUSAND TWO HUNDRED FORTY FIVE PESOS AND 81/100"
This comment was minimized by the moderator on the site
Hello, Maxine
To get the result you said, please apply the below code:
After pasting the code, please apply this formula:=SpellNumberToEnglish(A2)
Function SpellNumberToEnglish(ByVal pNumber)
'Update by Extendoffice
Dim Dollars, Cents
arr = Array("", "", " Thousand ", " Million ", " Billion ", " Trillion ")
pNumber = Trim(Str(pNumber))
xDecimal = InStr(pNumber, ".")
If xDecimal > 0 Then
    Cents = Left(Mid(pNumber, xDecimal + 1) & "00", 2) & "/100" 'GetTens(Left(Mid(pNumber, xDecimal + 1) & "00", 2))
    pNumber = Trim(Left(pNumber, xDecimal - 1))
End If
xIndex = 1
Do While pNumber <> ""
    xHundred = ""
    xValue = Right(pNumber, 3)
    If Val(xValue) <> 0 Then
        xValue = Right("000" & xValue, 3)
        If Mid(xValue, 1, 1) <> "0" Then
            xHundred = GetDigit(Mid(xValue, 1, 1)) & " Hundred "
        End If
        If Mid(xValue, 2, 1) <> "0" Then
            xHundred = xHundred & GetTens(Mid(xValue, 2))
        Else
            xHundred = xHundred & GetDigit(Mid(xValue, 3))
        End If
    End If
    If xHundred <> "" Then
        Dollars = xHundred & arr(xIndex) & Dollars
    End If
    If Len(pNumber) > 3 Then
        pNumber = Left(pNumber, Len(pNumber) - 3)
    Else
        pNumber = ""
    End If
    xIndex = xIndex + 1
Loop
Select Case Dollars
    Case ""
        Dollars = "No Dollars"
    Case "One"
        Dollars = "One Dollar"
    Case Else
        Dollars = Dollars & " Dollars"
End Select
Select Case Cents
    Case ""
        Cents = "" ' " and No Cents"
    Case "One"
        Cents = "" 'and One Cent"
    Case Else
        Cents = " and " & Cents ' & " Cents"
End Select
SpellNumberToEnglish = Dollars & Cents
Debug.Print SpellNumberToEnglish
End Function
Function GetTens(pTens)
Dim Result As String
Result = ""
If Val(Left(pTens, 1)) = 1 Then
    Select Case Val(pTens)
        Case 10: Result = "Ten"
        Case 11: Result = "Eleven"
        Case 12: Result = "Twelve"
        Case 13: Result = "Thirteen"
        Case 14: Result = "Fourteen"
        Case 15: Result = "Fifteen"
        Case 16: Result = "Sixteen"
        Case 17: Result = "Seventeen"
        Case 18: Result = "Eighteen"
        Case 19: Result = "Nineteen"
        Case Else
    End Select
Else
Select Case Val(Left(pTens, 1))
    Case 2: Result = "Twenty "
    Case 3: Result = "Thirty "
    Case 4: Result = "Forty "
    Case 5: Result = "Fifty "
    Case 6: Result = "Sixty "
    Case 7: Result = "Seventy "
    Case 8: Result = "Eighty "
    Case 9: Result = "Ninety "
    Case Else
End Select
Result = Result & GetDigit(Right(pTens, 1))
End If
GetTens = Result
End Function
Function GetDigit(pDigit)
Select Case Val(pDigit)
    Case 1: GetDigit = "One"
    Case 2: GetDigit = "Two"
    Case 3: GetDigit = "Three"
    Case 4: GetDigit = "Four"
    Case 5: GetDigit = "Five"
    Case 6: GetDigit = "Six"
    Case 7: GetDigit = "Seven"
    Case 8: GetDigit = "Eight"
    Case 9: GetDigit = "Nine"
    Case Else: GetDigit = ""
End Select
End Function


Please have a try, hope it can help you!
This comment was minimized by the moderator on the site
Hi,

Great code thanks. One question. Is it possible to save someway this module to in any new document be avilable? Or i need do this process any time if im want this in another document?

Thanks
This comment was minimized by the moderator on the site
Hello Nemeth,

Glad to help. I have a solution to your question. You can save an empty document with VBA code as Excel Add-in (*.xlam). Then you can use the add-in by clicking the Developer tab > Excel-Add-ins in Excel. Please have a try. And if you have any questions, please don't hesitate to contact us. Have a nice day.

Sincerely,
Mandy
This comment was minimized by the moderator on the site
hi, how can i do the opposite, I want to convert from ( one hundred fifty five) to (155). could you help me please?
This comment was minimized by the moderator on the site
Hi, Ghada,For converting the words to numbers, you should apply the below code:After pasting the code, please use this formula: =wordstodigits(A2)Please try, hope it can help you!<div data-tag="code">Option Explicit
Const wordDollar1 = "DOLLAR"
Const wordDollar2 = "DOLLARS"
Const oneTrillion = "TRILLION"
Const oneBillion = "BILLION"
Const oneMillion = "MILLION"
Const oneThousand = "THOUSAND"
Const oneHundred = "HUNDRED"
Dim theWords As String

Function WordsToDigits(theWordCell As Range) As Currency
Dim curPart As String
Dim theDigits As Currency
Dim Pt1 As Integer
Dim Pt2 As Integer
Dim Trillions As Currency
Dim Billions As Currency
Dim Millions As Currency
Dim Thousands As Currency
Dim Hundreds As Currency
Dim Tens As Currency
Dim Units As Currency
Dim whatGroup As String
Dim theFraction As Double
Dim hasFraction As Boolean
If IsEmpty(theWordCell) Then
Exit Function
End If
theWords = UCase(Trim(Application.WorksheetFunction.Clean(theWordCell)))
theWords = Replace(theWords, "-", " ")
theWords = Replace(theWords, "DOLLARS", " ")
theWords = Replace(theWords, "DOLLAR", " ")
Do While InStr(theWords, " ") > 0
theWords = Replace(theWords, " ", " ")
Loop
If InStr(theWords, "/") > 0 Or InStr(theWords, " AND ") > 0 Then
hasFraction = True
theFraction = CalculateTheFraction()
End If
Trillions = EvaluateGroupValue(oneTrillion)
Billions = EvaluateGroupValue(oneBillion)
Millions = EvaluateGroupValue(oneMillion)
Thousands = EvaluateGroupValue(oneThousand)
If InStr(theWords, oneHundred) > 0 Then
curPart = Left(theWords, InStr(theWords, oneHundred) + Len(oneHundred))
theWords = Right(theWords, Len(theWords) - Len(curPart))
Hundreds = GetHundreds(curPart)
End If
theWords = Trim(theWords)
Tens = GetTens(theWords)
theDigits = CCur((Trillions * 1000000000000#)) + CCur((Billions * 1000000000#)) + _
CCur((Millions * 1000000#)) + CCur((Thousands * 1000)) + CCur((Hundreds * 100)) + Tens
If hasFraction Then
theDigits = theDigits + theFraction
End If
WordsToDigits = theDigits
End Function

Private Function EvaluateGroupValue(strGroup As String) As Currency
Dim curPart As String
If InStr(theWords, strGroup) > 0 Then
curPart = Left(theWords, InStr(theWords, strGroup) + Len(strGroup))
theWords = Right(theWords, Len(theWords) - Len(curPart))
EvaluateGroupValue = GetLargeValues(curPart, strGroup)
End If
End Function

Private Function GetLargeValues(strAmount As String, strGroup As String) As Currency
Dim tempText As String
Dim theTens As String
Dim theUnits As String
tempText = Trim(Left(strAmount, InStr(strAmount, strGroup) - 1))
tempText = Replace(tempText, strGroup, "")
If InStr(tempText, " " & oneHundred) > 0 Then
tempText = Replace(tempText, " " & oneHundred, "")
If InStr(tempText, " ") > 0 Then
GetLargeValues = GetUnits(Left(tempText, InStr(tempText, " ") - 1)) * 100
tempText = Right(tempText, Len(tempText) - InStr(tempText, " "))
If InStr(tempText, " ") > 0 Then
theTens = GetUnits(Left(tempText, InStr(tempText, " ") - 1))
theUnits = GetUnits(Trim(Right(tempText, Len(tempText) - InStr(tempText, " "))))
GetLargeValues = GetLargeValues + theTens + theUnits
Else
GetLargeValues = GetLargeValues + GetUnits(tempText)
End If
Else
GetLargeValues = GetUnits(tempText) * 100
End If
Exit Function
End If
If InStr(tempText, " ") > 0 Then
GetLargeValues = GetUnits(Left(tempText, InStr(tempText, " ") - 1))
GetLargeValues = GetLargeValues + GetUnits(Right(tempText, Len(tempText) - InStr(tempText, " ")))
Else
GetLargeValues = GetUnits(tempText)
End If
End Function

Private Function GetHundreds(strAmount As String) As Integer
Dim tempText As String
tempText = Trim(Left(strAmount, InStr(strAmount, oneHundred) - 1))
If InStr(tempText, " ") > 0 Then
GetHundreds = GetUnits(Left(tempText, InStr(tempText, " ") - 1))
GetHundreds = GetHundreds + GetUnits(Right(tempText, Len(tempText) - InStr(tempText, " ")))
Else
GetHundreds = GetUnits(tempText)
End If
End Function

Private Function GetTens(strAmount As String) As Integer
Dim tempText As String
tempText = Trim(strAmount)
If InStr(tempText, " ") > 0 Then
GetTens = GetUnits(Left(tempText, InStr(tempText, " ") - 1))
GetTens = GetTens + GetUnits(Right(tempText, Len(tempText) - InStr(tempText, " ")))
Else
GetTens = GetUnits(tempText)
End If
End Function

Private Function GetUnits(strAmount As String) As Integer
Dim tempText As String
tempText = Trim(strAmount)
Select Case tempText
Case Is = "ONE"
GetUnits = 1
Case Is = "TWO"
GetUnits = 2
Case Is = "THREE"
GetUnits = 3
Case Is = "FOUR"
GetUnits = 4
Case Is = "FIVE"
GetUnits = 5
Case Is = "SIX"
GetUnits = 6
Case Is = "SEVEN"
GetUnits = 7
Case Is = "EIGHT"
GetUnits = 8
Case Is = "NINE"
GetUnits = 9
Case Is = "TEN"
GetUnits = 10
Case Is = "ELEVEN"
GetUnits = 11
Case Is = "TWELVE"
GetUnits = 12
Case Is = "THIRTEEN"
GetUnits = 13
Case Is = "FOURTEEN"
GetUnits = 14
Case Is = "FIFTEEN"
GetUnits = 15
Case Is = "SIXTEEN"
GetUnits = 16
Case Is = "SEVENTEEN"
GetUnits = 17
Case Is = "EIGHTEEN"
GetUnits = 18
Case Is = "NINETEEN"
GetUnits = 19
Case Is = "TWENTY"
GetUnits = 20
Case Is = "THIRTY"
GetUnits = 30
Case Is = "FORTY", "FOURTY"
GetUnits = 40
Case Is = "FIFTY"
GetUnits = 50
Case Is = "SIXTY"
GetUnits = 60
Case Is = "SEVENTY"
GetUnits = 70
Case Is = "EIGHTY"
GetUnits = 80
Case Is = "NINETY"
GetUnits = 90
Case Else
GetUnits = 0
End Select
End Function

Private Function CalculateTheFraction() As Double
Dim fractionPart As String
Dim tempValue As Double
Dim toPower As Integer
Dim theDivisor As Double
If InStr(theWords, " AND ") > 0 Then
fractionPart = Right(theWords, Len(theWords) - InStr(theWords, " AND ") - 4)
theWords = Left(theWords, InStr(theWords, " AND ") - 1)
End If
If InStr(fractionPart, "/") > 0 Then
tempValue = Val(fractionPart)
theDivisor = Right(fractionPart, Len(fractionPart) - InStr(fractionPart, "/"))
CalculateTheFraction = tempValue / theDivisor
Exit Function
End If
tempValue = Val(fractionPart)
toPower = Len(CStr(tempValue))
theDivisor = 10 ^ toPower
CalculateTheFraction = tempValue / theDivisor
End Function
This comment was minimized by the moderator on the site
FINE. But sorry to say that this formula is NOT working permanently ... I closed the workbook for Lunch break. After Lunch I opened the file but the formula was not working. showing error like #NAME?. Kindly intimate solutions please.
This comment was minimized by the moderator on the site
Hello, Vignesh,To keep the code work correctly, you should save the workbbok as Excel Macro-Enabled Workbook format.Please try, hope it can help you!
This comment was minimized by the moderator on the site
But sorry to say that this formula is NOT working permanently ... I closed the workbook for Lunch break. After Lunch I opened the file but the formula was not working. showing error like #NAME?. Kindly intimate solutions please.
This comment was minimized by the moderator on the site
how do I convert 1101 to One One Zero One? I don't need dollars just want actual digits.
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations