+ Reply to Thread
Results 1 to 2 of 2

Number System

  1. #1
    Forum Contributor
    Join Date
    07-17-2012
    Location
    bangalore
    MS-Off Ver
    Excel 2007
    Posts
    461

    Number System

    Hi All,

    I have the below code to be edited. It works fine with the 10^8. Beyond that its is not working. I want it to be extended till 10^18.


    10^9 One Hundred Crore
    10^10 One Thousand Crore
    10^11 Ten Thousand Crore
    10^12 One Lakh Crore
    10^13 Ten Lakh Crore
    10^14 One Crore Crore
    10^15 Ten Crore Crore
    10^16 One Hundred Crore Crore
    10^17 One Thousand Crore Crore
    10^18 Ten Thousand Crore Core




    #
    #
    Function SpellNumber(amt As Variant) As Variant
    Dim FIGURE As Variant
    Dim LENFIG As Integer
    Dim i As Integer
    Dim WORDs(19) As String
    Dim tens(9) As String
    WORDs(1) = "One"
    WORDs(2) = "Two"
    WORDs(3) = "Three"
    WORDs(4) = "Four"
    WORDs(5) = "Five"
    WORDs(6) = "Six"
    WORDs(7) = "Seven"
    WORDs(8) = "Eight"
    WORDs(9) = "Nine"
    WORDs(10) = "Ten"
    WORDs(11) = "Eleven"
    WORDs(12) = "Twelve"
    WORDs(13) = "Thirteen"
    WORDs(14) = "Fourteen"
    WORDs(15) = "Fifteen"
    WORDs(16) = "Sixteen"
    WORDs(17) = "Seventeen"
    WORDs(18) = "Eighteen"
    WORDs(19) = "Nineteen"
    tens(2) = "Twenty"
    tens(3) = "Thirty"
    tens(4) = "Fourty"
    tens(5) = "Fifty"
    tens(6) = "Sixty"
    tens(7) = "Seventy"
    tens(8) = "Eighty"
    tens(9) = "Ninety"
    FIGURE = amt
    FIGURE = Format(FIGURE, "FIXED")
    FIGLEN = Len(FIGURE)
    If FIGLEN < 12 Then
    FIGURE = Space(12 - FIGLEN) & FIGURE
    End If
    If Val(Left(FIGURE, 9)) > 1 Then
    SpellNumber = "Rupees "
    ElseIf Val(Left(FIGURE, 9)) = 1 Then
    SpellNumber = "Rupee "
    End If
    For i = 1 To 3
    If Val(Left(FIGURE, 2)) < 20 And Val(Left(FIGURE, 2)) > 0 Then
    SpellNumber = SpellNumber & WORDs(Val(Left(FIGURE, 2)))
    ElseIf Val(Left(FIGURE, 2)) > 19 Then
    SpellNumber = SpellNumber & tens(Val(Left(FIGURE, 1)))
    SpellNumber = SpellNumber & WORDs(Val(Right(Left(FIGURE, 2), 1)))
    End If
    If i = 1 And Val(Left(FIGURE, 2)) > 0 Then
    SpellNumber = SpellNumber & " Crore "
    ElseIf i = 2 And Val(Left(FIGURE, 2)) > 0 Then
    SpellNumber = SpellNumber & " Lakh "
    ElseIf i = 3 And Val(Left(FIGURE, 2)) > 0 Then
    SpellNumber = SpellNumber & " Thousand "
    End If
    FIGURE = Mid(FIGURE, 3)
    Next i
    If Val(Left(FIGURE, 1)) > 0 Then
    SpellNumber = SpellNumber & WORDs(Val(Left(FIGURE, 1))) + " Hundred "
    End If
    FIGURE = Mid(FIGURE, 2)
    If Val(Left(FIGURE, 2)) < 20 And Val(Left(FIGURE, 2)) > 0 Then
    SpellNumber = SpellNumber & WORDs(Val(Left(FIGURE, 2)))
    ElseIf Val(Left(FIGURE, 2)) > 19 Then
    SpellNumber = SpellNumber & tens(Val(Left(FIGURE, 1)))
    SpellNumber = SpellNumber & WORDs(Val(Right(Left(FIGURE, 2), 1)))
    End If
    FIGURE = Mid(FIGURE, 4)
    If Val(FIGURE) > 0 Then
    SpellNumber = SpellNumber & " Paise "
    If Val(Left(FIGURE, 2)) < 20 And Val(Left(FIGURE, 2)) > 0 Then
    SpellNumber = SpellNumber & WORDs(Val(Left(FIGURE, 2)))
    ElseIf Val(Left(FIGURE, 2)) > 19 Then
    SpellNumber = SpellNumber & tens(Val(Left(FIGURE, 1)))
    SpellNumber = SpellNumber & WORDs(Val(Right(Left(FIGURE, 2), 1)))
    End If
    End If
    FIGURE = amt
    FIGURE = Format(FIGURE, "FIXED")
    If Val(FIGURE) > 0 Then
    SpellNumber = SpellNumber & " Only "
    End If
    End Function
    Last edited by sathishkm; 01-27-2021 at 10:42 AM.

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,126

    Re: Number System

    Administrative Note:

    Welcome back to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Formula to convert number into word (Indian number system) without VBA or Add-in
    By basantsharma in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-22-2020, 01:54 PM
  2. hello, help building a system * that each number has a percentage.
    By jorel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-12-2019, 10:41 AM
  3. Counting number of people in a queueing system
    By Tob229 in forum Excel General
    Replies: 2
    Last Post: 12-12-2016, 10:15 PM
  4. Different number base system
    By evertjvr in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 06-23-2012, 05:37 AM
  5. Calculate Number of Users Logged Into A System Each Hour Of The Day
    By reillyj in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-10-2012, 07:13 AM
  6. Number Tracking System
    By jason_kelly in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-15-2010, 02:40 PM
  7. Replies: 0
    Last Post: 02-13-2006, 04:45 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1