logo elektroda
logo elektroda
X
logo elektroda

Converting Numeric Amount to Words in Excel for VAT Invoices

bkroy 198980 42
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 6551057
    bkroy
    Level 11  
    Hello,
    How in Excel can you change the value from a cell in which the amount (number) is entered into text (number written in words). I need this formula to issue internal VAT invoices. Please help.

    Greetings.
  • ADVERTISEMENT
  • #4 8006095
    RadekS
    Level 12  
    maybe a bit late, but it's better than never ;)
    I attach a file with a description and a file,
    which converts numeric values to "in words"
    It really makes life easier! :)

    The file "Slownie.xls" should be copied to the folder [drive]: \ Microsoft Office \ Office \ XLStart. After this procedure, each time the sheet is opened, a new function will be available (WORDS.XLS! Words ()) in "Paste function / Function category: / User". After calling the function, enter directly the number in the "argument" field or indicate the cell from which the argument will be taken.
    Attachments:
  • #7 8169430
    dawidmarek
    Level 10  
    Hello
    It's great with this feature, but I have such a problem. I have an attendance list, and in one of the cells I have the number of hours worked with a number, and on vacation leave I have the abbreviation "UW"
    And here I have a question what function to use to add the sum of the text "UW" to me and write in the summary, for example

    Vacation quantity 8

    Please help
    greetings
  • #8 8171254
    walek33
    Level 29  
    dawidmarek wrote:
    Hello
    It's great with this feature, but I have such a problem. I have an attendance list, and in one of the cells I have the number of hours worked with a number, and on vacation leave I have the abbreviation "UW"
    And here I have a question what function to use to add the sum of the text "UW" to me and write in the summary, for example

    Vacation quantity 8

    Please help
    greetings


    I don't mean to be cranky, but this is probably a new topic?
    By the way, if this data is in two columns then use a formula sum.if (range, "UW", sum_range)

    Added:
    If the data is in one column:
    count.if (range, "UW") * 8
  • #9 8259311
    okobaka
    Level 11  
    RadekS wrote:
    okobaka: in the topic: https://www.elektroda.pl/rtvforum/topic84095.html - the case was based on macros, vba, while the prepared by me is functionally called and starts every time we turn on excel. To sum up - each method leading to a specific goal is the best possible


    I use your function, but I noticed that if I copy it to C: \ Microsoft Office \ Office \ XLStart, the excel window opens, but it is empty - you have to minimize it and only then the workbook opens in the window and it is like that every time .

    RadekS, I would like to ask you to add pennies to this function, but written in this way :)
    e.g. 99.99 = ninety-nine zlotys and 99/100 groszy :)
    and that each time the function shows pennies
    for example: 99.00 = ninety-nine zlotys and 00/100 gr
    and remove the parentheses and text (say :)

    I would be grateful.
  • ADVERTISEMENT
  • #10 8264871
    RadekS
    Level 12  
    hmm, this is not my - as you wrote - formula / function, I use it myself because it is convenient and simple, but I did not work on its creation

    I propose to see other solutions of this type given in the files, as well as the study from the website:
    http://www.excelblog.pl/kwota-slownie-bez-vba/
  • ADVERTISEMENT
  • #11 8272615
    okobaka
    Level 11  
    Thanks for the correction ... it was enough to improve this function a bit, maybe you know where this "Slownie.zip" file is from - because I'm looking for the source?

    Edited 7/28/2010
    Today I had some time and I just pressed ALT + F11 and the macro that I wanted popped up, you can change what you want ... there is also the author and tp information ...

    Edited 8/2/2010
    I changed the macro again like this:

    I replaced that piece of code that was originally ...
    'If po_przecinku >= 1 Then
    '    liczba = po_przecinku
    '    GoSub zamiana
    '    y$ = xxx$
    '    groszy$ = " " + y$ + " gr) "
    '    Else
    '    groszy$ = ") "
    'End If

    ... with this piece of code.
    [code:1:758bd4b38c] reszta_z$ = Int(po_przecinku)

    If reszta_z$ >= 0 And reszta_z$
  • #12 8891543
    Kluska81
    Level 10  
    Hello

    @okobaka
    you could throw in ready after macro modification

    EDIT:

    I found such a macro on the Internet, only one problem is that the value of pennies is also given in words
    e.g.
    123.45 PLN
    one hundred and twenty-three zlotys and forty-five groszy
    and I would like to achieve such an effect
    one hundred and twenty-three PLN 45/100

    Function Słownie(Liczba As Variant, Optional CzyWaluta) As Variant
    '***********************************************************
    ' Makro do przeliczania liczby na słownie
    ' (c) 2001 by Bartłomiej Sosenko
    '***********************************************************
    
    Dim LiczbaP, Wynik, Slowo, SlowoP, Slowo2, i, Przyrostki
    Dim Przyrostek, Przedrostek, Grosze, Jednostki, dziesiatki, setki, gr
    
    If IsMissing(CzyWaluta) Then CzyWaluta = True
    
    If Liczba < 0 Then
    Liczba = -Liczba
    Przedrostek = "minus "
    End If
    
    
    Grosze = ""
    If InStr(1, Liczba, ",", 1) > 0 Then
     Grosze = Right(Liczba, Len(Liczba) - InStr(1, Liczba, ",", 1))
     If Len(Grosze) = 1 Then Grosze = Grosze & "0"
     If Len(Grosze) > 2 Then Grosze = Left(Grosze, 2)
     Liczba = Left(Liczba, InStr(1, Liczba, ",", 1) - 1)
    End If
    Jednostki = Array("", "jeden", "dwa", "trzy", "cztery", _
                      "pięć", "sześć", "siedem", "osiem", "dziewięć", _
                      "dziesięć", "jedenaście", "dwanaście", "trzynaście", _
                      "czternaście", "piętnaście", "szesnaście", "siedemnaście", _
                      "osiemnaście", "dziewiętnaście")
    dziesiatki = Array("", "dziesięć", "dwadzieścia", "trzydzieści", "czterdzieści", _
                      "pięćdziesiąt", "sześćdziesiąt", "siedemdziesiąt", _
                      "osiemdziesiąt", "dziewięćdziesiąt")
    setki = Array("", "sto", "dwieście", "trzysta", "czterysta", "pięćset", "sześćset", _
                  "siedemset", "osiemset", "dziewięćset")
    Slowo = ""
    For gr = 1 To 2
    If Len(Liczba) - (Len(Liczba) \ 3) * 3 = 2 Then Liczba = "0" & Liczba
    If Len(Liczba) - (Len(Liczba) \ 3) * 3 = 1 Then Liczba = "00" & Liczba
    For i = 1 To (Len(Liczba) + 2) \ 3
      SlowoP = ""
      If i > 1 Then
        LiczbaP = Mid(Liczba, Len(Liczba) - (i * 3) + 1, 3)
      Else
        LiczbaP = Liczba
      End If
      If Right(LiczbaP, 2) < 20 Then
        SlowoP = Jednostki(Right(LiczbaP, 2)) & " " & SlowoP
      Else
        Slowo2 = dziesiatki(Left(Right(LiczbaP, 2), 1))
        Slowo2 = Slowo2 & " " & Jednostki(Right(LiczbaP, 1))
        SlowoP = Slowo2 & " " & SlowoP
      End If
      If LiczbaP > 99 Then
       SlowoP = setki(Left(Right(LiczbaP, 3), 1)) & " " & SlowoP
      End If
      Select Case i
       Case 1:
                If CzyWaluta Then
                  If (gr = 2) Then
                   Przyrostki = Array("grosz", "grosze", "groszy")
                  Else
                   Przyrostki = Array("złoty ", "złote ", "złotych ")
                  End If
                Else
                  If (gr = 2) Then
                   Przyrostki = Array("setna", "setne", "setnych")
                  Else
                   Przyrostki = Array("", "", "")
                  End If
                End If
       Case 2:  Przyrostki = Array("tysiąc ", "tysiące ", "tysięcy ")
       Case 3:  Przyrostki = Array("milion ", "miliony ", "milionów ")
       Case 4:  Przyrostki = Array("miliard ", "miliardy ", "miliardów ")
       Case 5:  Przyrostki = Array("bilion ", "biliony ", "bilionów ")
      End Select
      If ((LiczbaP  0) And i > 1) Or (gr > 0) Then
       If LiczbaP  0 Then
         If LiczbaP = 1 Then
          Przyrostek = Przyrostki(0)
         Else
            If ((Right(LiczbaP, 1) > 1) And (Right(LiczbaP, 1) < 5)) Or _
               ((Right(LiczbaP, 2) > 21) And (Right(LiczbaP, 1) > 1) And _
                (Right(LiczbaP, 1) < 5)) Then Przyrostek = Przyrostki(1)
            If ((Right(LiczbaP, 2) > 4) And (Right(LiczbaP, 2) < 22)) Or _
               ((Right(LiczbaP, 2) > 21) And (Right(LiczbaP, 1) > 4) And _
                (Right(LiczbaP, 1) < 22)) Or (Right(LiczbaP, 1) = 0) Or _
                (Right(LiczbaP, 1) = 1) Then Przyrostek = Przyrostki(2)
         End If
         If gr = 1 Then
          Slowo = SlowoP & Przyrostek & Slowo
         Else
          Slowo = Slowo & SlowoP & Przyrostek
         End If
       End If
      End If
    Next i
    If Grosze = "" Then
     Exit For
    Else
     If Liczba > 0 Then If gr = 1 Then Slowo = Slowo & "i "
     Liczba = Grosze
    End If
    Next gr
    If Liczba = 0 Then Slowo = "zero" & Slowo
    Słownie = IIf(IsEmpty(Przedrostek), Slowo, Przedrostek & Slowo)
    End Function


    could I ask for help in modifying the macro
  • #13 9196149
    robson1313
    Level 2  
    A very convenient solution:
    The file nabla.xla is "inserted" into the library, e.g.
    = 'C: \ Program Files \ Microsoft Office \ OFFICE11 \ LIBRARY \ NABLA.XLA
    either on a different path with libraries.
    In excel additions it will appear as 'nabla'
    Using: insert function (financial) SFACT (.....)
    It doesn't always alter correctly by chance, but it's probably survivable.
  • #14 10591864
    jar_gogo
    Level 11  
    @okobaka

    Could you please share the macro from the post above, because I really need it and unfortunately writing macros is not my forte. You made it, and I just want the display form you have edited. More precisely, I mean that it should be displayed in this way:

    PLN 159.37
    In words: one hundred and fifty-nine zlotys 37/100 gr


    Thank you in advance, in my and not my own name, and best regards.
  • #15 10877070
    misiuv
    Level 2  
    I recommend a solution based on user functions
  • #16 10905910
    Ludek72
    Level 9  
    RadekS wrote:
    maybe a bit late, but it's better than never ;)
    I attach a file with a description and a file,
    which converts numeric values to "in words"
    It really makes life easier! :)

    The file "Slownie.xls" should be copied to the folder [drive]: \ Microsoft Office \ Office \ XLStart. After this procedure, each time the sheet is opened, a new function will be available (WORDS.XLS! Words ()) in "Paste function / Function category: / User". After calling the function, enter directly the number in the "argument" field or indicate the cell from which the argument will be taken.


    Thanks alot.
  • ADVERTISEMENT
  • #17 10948146
    okobaka
    Level 11  
    I edited the post, but now it is waiting for the approval of the moderator's change. He states again - a little more legible.

    I replaced a piece of that original code ...
    If po_przecinku >= 1 Then
     liczba = po_przecinku
     GoSub zamiana
     y$ = xxx$
     groszy$ = " " + y$ + " gr) "
     Else
     groszy$ = ") "
    End If
    


    ... this.
    [code:1:18a6762dda]'If po_przecinku >= 1 Then
    ' liczba = po_przecinku
    ' GoSub zamiana
    ' y$ = xxx$
    ' groszy$ = " " + y$ + " gr) "
    ' Else
    ' groszy$ = ") "
    'End If
    reszta_z$ = Int(po_przecinku)

    If reszta_z$ >= 0 And reszta_z$
  • #18 11033811
    Antidotum ex
    Level 11  
    Free - Excel formula to change amount to text (amount in words) - no macros.
    I provide a formula that I wrote myself and make it available to everyone for free.
    I don't think it's new, maybe someone has a better solution - and that's my ver.
    Formula originally written in OpenOffice, also works in Excel (I checked).
    Maximum is: 999 999 999 999.99. The file is not encoded, you can rummage in it, it is enough to reveal rows between J and S in the Sheet.
    In the attachment I am sending the file: Amount for text.xls

    good luck and best regards
  • #19 11140985
    AJaqubek
    Level 10  
    Beautiful formula for converting an amount into text. Xls.
    I am looking for something like this and I have no idea about creating macros myself. There is only one request to change the word amount ending to look like this:
    PLN 1,200.20 - one thousand two hundred PLN 20/100, or
    PLN 1,200.20 - one thousand two hundred PLN 20/100
    I myself have no idea about creating macros

    good luck and best regards
  • #20 11141332
    marek003
    Level 40  
    Which example are you writing about?
    There is no macro in the last of these. Everything is based on Excel formulas.
    Discover columns K to Q and you will see the "engine" of functions that turn numbers into words.



    I, in turn, use my own solution without macros: an additional sheet and my own names. Below is an example

    An ending in the "PLN" style can be added in the last formula. because it is not always all about money. :)
  • #21 11164810
    AJaqubek
    Level 10  
    There is no macro in the last of these. Everything is based on Excel formulas.
    Discover columns K to Q and you will see the "engine" of functions that turn numbers into words.



    I select the columns and I click "discover", but it asks for a password ???

    And how to solve the problem of writing, for example, 30 - 40 different amounts in words?
    I want to put something like this in the tender sheets - different tenders and different amounts of numbers
  • #22 11166659
    marek003
    Level 40  
    AJaqubek wrote:

    I select the columns and I click "discover", but it asks for a password ???

    Strange because he doesn't ask for me (an "discovered" example is attached)

    AJaqubek wrote:

    And how to solve the problem of writing, for example, 30 - 40 different amounts in words?


    Here, however, I propose to use a macro (enter it into the module in VBA)

    Below, the last macros in this thread have been adapted to your needs.
    At the same time, I changed them a little so that the currency was given out of hand (it can be PLN, it can be EUR, it can be CHF - whatever you want)

    For example, if you have a number in A1, you enter it in b1 = In words (A1; "PLN") or = In words (A!; "EUR") and the function will return a value in words with the ending zl. If you do not specify "currency", the function will only return a word number with hundredths in the fraction.


    Function Słownie(Liczba As Variant, Optional Waluta As String) As Variant
    
    '***********************************************************
    ' Makro do przeliczania liczby na słownie
    ' (c) 2001 by Bartłomiej Sosenko
    'Troszeczkę przerobione by grosze były w ułamku i możliwością wprowadzenia dowolnej waluty (c) 2012 by marek003    :)
    
    '***********************************************************
    
    Dim LiczbaP, Wynik, Slowo, SlowoP, Slowo2, i, Przyrostki
    Dim Przyrostek, Przedrostek, Grosze, Jednostki, dziesiatki, setki
    
    
    If Liczba < 0 Then
    Liczba = -Liczba
    Przedrostek = "minus "
    End If
    
    
    Grosze = ""
    If InStr(1, Liczba, ",", 1) > 0 Then
     Grosze = Right(Liczba, Len(Liczba) - InStr(1, Liczba, ",", 1))
     If Len(Grosze) = 1 Then Grosze = Grosze & "0"
     If Len(Grosze) > 2 Then Grosze = Left(Grosze, 2)
     Liczba = Left(Liczba, InStr(1, Liczba, ",", 1) - 1)
    End If
    
    
    
    
    Jednostki = Array("", "jeden", "dwa", "trzy", "cztery", _
                      "pięć", "sześć", "siedem", "osiem", "dziewięć", _
                      "dziesięć", "jedenaście", "dwanaście", "trzynaście", _
                      "czternaście", "piętnaście", "szesnaście", "siedemnaście", _
                      "osiemnaście", "dziewiętnaście")
    dziesiatki = Array("", "dziesięć", "dwadzieścia", "trzydzieści", "czterdzieści", _
                      "pięćdziesiąt", "sześćdziesiąt", "siedemdziesiąt", _
                      "osiemdziesiąt", "dziewięćdziesiąt")
    setki = Array("", "sto", "dwieście", "trzysta", "czterysta", "pięćset", "sześćset", _
                  "siedemset", "osiemset", "dziewięćset")
    Slowo = ""
    
    
        If Len(Liczba) - (Len(Liczba) \ 3) * 3 = 2 Then Liczba = "0" & Liczba
        If Len(Liczba) - (Len(Liczba) \ 3) * 3 = 1 Then Liczba = "00" & Liczba
        
        For i = 1 To (Len(Liczba) + 2) \ 3
          SlowoP = ""
          If i > 1 Then
            LiczbaP = Mid(Liczba, Len(Liczba) - (i * 3) + 1, 3)
          Else
            LiczbaP = Liczba
          End If
          
          If Right(LiczbaP, 2) < 20 Then
            SlowoP = Jednostki(Right(LiczbaP, 2)) & " " & SlowoP
          Else
            Slowo2 = dziesiatki(Left(Right(LiczbaP, 2), 1))
            Slowo2 = Slowo2 & " " & Jednostki(Right(LiczbaP, 1))
            SlowoP = Slowo2 & " " & SlowoP
          End If
          
          If LiczbaP > 99 Then
           SlowoP = setki(Left(Right(LiczbaP, 3), 1)) & " " & SlowoP
          End If
          
          Select Case i
           Case 1:  Przyrostki = Array(" ", " ", " ")
           Case 2:  Przyrostki = Array("tysiąc ", "tysiące ", "tysięcy ")
           Case 3:  Przyrostki = Array("milion ", "miliony ", "milionów ")
           Case 4:  Przyrostki = Array("miliard ", "miliardy ", "miliardów ")
           Case 5:  Przyrostki = Array("bilion ", "biliony ", "bilionów ")
          End Select
          
           If LiczbaP  0 Then
             If LiczbaP = 1 Then
              Przyrostek = Przyrostki(0)
             Else
                If ((Right(LiczbaP, 1) > 1) And (Right(LiczbaP, 1) < 5)) Or _
                ((Right(LiczbaP, 2) > 21) And (Right(LiczbaP, 1) > 1) _
                And (Right(LiczbaP, 1) < 5)) Then Przyrostek = Przyrostki(1)
                If ((Right(LiczbaP, 2) > 4) And (Right(LiczbaP, 2) < 22)) Or _
                ((Right(LiczbaP, 2) > 21) And (Right(LiczbaP, 1) > 4) And (Right(LiczbaP, 1) < 22)) _
                Or (Right(LiczbaP, 1) = 0) Or (Right(LiczbaP, 1) = 1) Then Przyrostek = Przyrostki(2)
             End If
              Slowo = SlowoP & Przyrostek & Slowo
           End If
        Next i
        
    
    If Liczba = 0 And Grosze = "" Then Slowo = "zero" & Slowo & " " & Waluta
    
    If Grosze  "" Then Slowo = Slowo & Grosze & "/100" & " " & Waluta
         
    Słownie = IIf(IsEmpty(Przedrostek), Slowo, Przedrostek & Slowo)
    
    
    
    
    
    End Function



    added after a while

    --------------------------------------------

    I added the letter "i" to the text
  • #23 11167780
    Antidotum ex
    Level 11  
    Any amount of quota can be used easily without VBA.
    In each exercise book, copy the entire "Amount for text" sheet to, for example: Sheet1,
    then select the cell with the amount in your worksheet, do "Ctrl C" and paste into the cell with the amount in the Template Sheet1 with "Ctrl V" (replace the cells with the number amount). Then here select the cell with the selected amount in words, do "Ctrl C" and paste with "Ctrl V" into the cell with the amount in words on your sheet. Everything works.
    kisses
  • #24 11168513
    AJaqubek
    Level 10  
    [quote = "Antidotum ex"] Any amount of quota can be used easily without VBA.
    In each exercise book, copy the entire sheet "Amount for text", .......... to, for example: Sheet1.


    Works great for invoicing.
    But when creating a tender for each item "in words", you need to create a new sheet. It is inconvenient when creating offers, e.g. containing 30 items. In 2 weeks, I create an offer again, for example for 20 or 40 items. So all the time I have to either add or subtract items in the offer, which is associated with constantly entering paths to enter the amount verbally and make sure that it pulls off a good sheet. Enclosed is a fragment of such OFFER form. Maybe you can do something.
  • #25 11168683
    jar_gogo
    Level 11  
    Hello @AJaqubek
    In this case, the macro will be the best solution for you @ marek003 . It works great and should fix your problems. You just have to follow its description above the macro itself.

    I also have a question for @ marek003 .
    As I can not write macros, could you help me change them a bit (it is the final entry) so that the record looks like this:

    PLN 159.37
    one hundred and fifty-nine zlotys 37/100 gr

    If it is possible @ marek003 thank you in advance.
  • #26 11169374
    AJaqubek
    Level 10  
    As I can not write macros, could you help me change them a bit (it is the final entry) so that the record looks like this:

    PLN 159.37
    one hundred and fifty-nine zlotys 37/100 gr


    I think the journal entry:
    one hundred and fifty-nine zlotys 37/100 gr
    is not correct, because we read (ending): thirty-seven hundredths of a penny
  • #27 11169662
    jar_gogo
    Level 11  
    AJaqubek wrote:

    I think the journal entry:
    one hundred and fifty-nine zlotys 37/100 gr
    is not correct, because we read (ending): thirty-seven hundredths of a penny


    Maybe you are right, then I repeat my request to @ marek003 but without the abbreviation "gr"
  • #28 11169668
    marek003
    Level 40  
    Here you are:
    1st version
    PLN 159.37
    one hundred and fifty-nine zlotys 37/100 gr

    I added the letter "i" but if someone does not fit, remove this condition with one hyphen "&" in the penultimate line of code
    IIf (Number = 0, "", "and")

    I only continued with the option of different currencies
    so the function looks like this:

    = Words (value; "PLN"; "gr")

    Of course, if they are omitted from the definition of currencies - they will not be shown. or if you change them, the effect will be the same as in the previous macro, i.e.
    = In words (value ;; "PLN") will give you one hundred and fifty-nine and 37/100 PLN

    Or whatever you like

    = In words (value; "PLN") will give you one hundred and fifty-nine zlotys and 37/100


    Function Słownie(Liczba As Variant, Optional Waluta As String, Optional Waluta2 As String) As Variant
    
    '***********************************************************
    ' Makro do przeliczania liczby na słownie
    ' (c) 2001 by Bartłomiej Sosenko
    'Troszeczkę przerobione by grosze były w ułamku i możliwością wprowadzenia dowolnej waluty
    ' i jeszcze paroma zmianami(c) 2012 by marek003    :)
    
    '***********************************************************
    
    Dim LiczbaP, Wynik, Slowo, SlowoP, Slowo2, i, Przyrostki
    Dim Przyrostek, Przedrostek, Grosze, Jednostki, dziesiatki, setki
    
    
    If Liczba < 0 Then
    Liczba = -Liczba
    Przedrostek = "minus "
    End If
    
    
    Grosze = ""
    If InStr(1, Liczba, ",", 1) > 0 Then
     Grosze = Right(Liczba, Len(Liczba) - InStr(1, Liczba, ",", 1))
     If Len(Grosze) = 1 Then Grosze = Grosze & "0"
     If Len(Grosze) > 2 Then Grosze = Left(Grosze, 2)
     Liczba = Left(Liczba, InStr(1, Liczba, ",", 1) - 1)
    End If
    
    
    
    
    Jednostki = Array("", "jeden", "dwa", "trzy", "cztery", _
                      "pięć", "sześć", "siedem", "osiem", "dziewięć", _
                      "dziesięć", "jedenaście", "dwanaście", "trzynaście", _
                      "czternaście", "piętnaście", "szesnaście", "siedemnaście", _
                      "osiemnaście", "dziewiętnaście")
    dziesiatki = Array("", "dziesięć", "dwadzieścia", "trzydzieści", "czterdzieści", _
                      "pięćdziesiąt", "sześćdziesiąt", "siedemdziesiąt", _
                      "osiemdziesiąt", "dziewięćdziesiąt")
    setki = Array("", "sto", "dwieście", "trzysta", "czterysta", "pięćset", "sześćset", _
                  "siedemset", "osiemset", "dziewięćset")
    Slowo = ""
    
    
        If Len(Liczba) - (Len(Liczba) \ 3) * 3 = 2 Then Liczba = "0" & Liczba
        If Len(Liczba) - (Len(Liczba) \ 3) * 3 = 1 Then Liczba = "00" & Liczba
        
        For i = 1 To (Len(Liczba) + 2) \ 3
          SlowoP = ""
          If i > 1 Then
            LiczbaP = Mid(Liczba, Len(Liczba) - (i * 3) + 1, 3)
          Else
            LiczbaP = Liczba
          End If
          
          If Right(LiczbaP, 2) < 20 Then
            SlowoP = Jednostki(Right(LiczbaP, 2)) & " " & SlowoP
          Else
            Slowo2 = dziesiatki(Left(Right(LiczbaP, 2), 1))
            Slowo2 = Slowo2 & " " & Jednostki(Right(LiczbaP, 1))
            SlowoP = Slowo2 & " " & SlowoP
          End If
          
          If LiczbaP > 99 Then
           SlowoP = setki(Left(Right(LiczbaP, 3), 1)) & " " & SlowoP
          End If
          
          Select Case i
           Case 1:  Przyrostki = Array(Waluta & " ", Waluta & " ", Waluta & " ")
           Case 2:  Przyrostki = Array("tysiąc ", "tysiące ", "tysięcy ")
           Case 3:  Przyrostki = Array("milion ", "miliony ", "milionów ")
           Case 4:  Przyrostki = Array("miliard ", "miliardy ", "miliardów ")
           Case 5:  Przyrostki = Array("bilion ", "biliony ", "bilionów ")
          End Select
          
           If LiczbaP  0 Then
             If LiczbaP = 1 Then
              Przyrostek = Przyrostki(0)
             Else
                If ((Right(LiczbaP, 1) > 1) And (Right(LiczbaP, 1) < 5)) Or _
                ((Right(LiczbaP, 2) > 21) And (Right(LiczbaP, 1) > 1) _
                And (Right(LiczbaP, 1) < 5)) Then Przyrostek = Przyrostki(1)
                If ((Right(LiczbaP, 2) > 4) And (Right(LiczbaP, 2) < 22)) Or _
                ((Right(LiczbaP, 2) > 21) And (Right(LiczbaP, 1) > 4) And (Right(LiczbaP, 1) < 22)) _
                Or (Right(LiczbaP, 1) = 0) Or (Right(LiczbaP, 1) = 1) Then Przyrostek = Przyrostki(2)
             End If
              Slowo = SlowoP & Przyrostek & Slowo
           End If
        Next i
        
    
    If Liczba = 0 And Grosze = "" Then Slowo = "zero" & Slowo & " " & Waluta
    
    If Grosze  "" Then Slowo = Slowo & IIf(Liczba = 0, "", "i ") & Grosze & "/100" & " " & Waluta2
          
    Słownie = IIf(IsEmpty(Przedrostek), Slowo, Przedrostek & Slowo)
    
    
    
    
    
    End Function



    Below
    2 version
    PLN 159.37
    one hundred and fifty-nine zlotys and 37 groszy

    Also with the option of currencies, i.e. the function record
    = Words (value; "PLN"; "gr")

    Function Słownie(Liczba As Variant, Optional Waluta As String, Optional Waluta2 As String) As Variant
    
    '***********************************************************
    ' Makro do przeliczania liczby na słownie
    ' (c) 2001 by Bartłomiej Sosenko
    'Troszeczkę przerobione by grosze były w ułamku i możliwością wprowadzenia dowolnej waluty
    ' i jeszcze paroma zmianami(c) 2012 by marek003    :)
    
    '***********************************************************
    
    Dim LiczbaP, Wynik, Slowo, SlowoP, Slowo2, i, Przyrostki
    Dim Przyrostek, Przedrostek, Grosze, Jednostki, dziesiatki, setki
    
    
    If Liczba < 0 Then
    Liczba = -Liczba
    Przedrostek = "minus "
    End If
    
    
    Grosze = ""
    If InStr(1, Liczba, ",", 1) > 0 Then
     Grosze = Right(Liczba, Len(Liczba) - InStr(1, Liczba, ",", 1))
     If Len(Grosze) = 1 Then Grosze = Grosze & "0"
     If Len(Grosze) > 2 Then Grosze = Left(Grosze, 2)
     Liczba = Left(Liczba, InStr(1, Liczba, ",", 1) - 1)
    End If
    
    
    
    
    Jednostki = Array("", "jeden", "dwa", "trzy", "cztery", _
                      "pięć", "sześć", "siedem", "osiem", "dziewięć", _
                      "dziesięć", "jedenaście", "dwanaście", "trzynaście", _
                      "czternaście", "piętnaście", "szesnaście", "siedemnaście", _
                      "osiemnaście", "dziewiętnaście")
    dziesiatki = Array("", "dziesięć", "dwadzieścia", "trzydzieści", "czterdzieści", _
                      "pięćdziesiąt", "sześćdziesiąt", "siedemdziesiąt", _
                      "osiemdziesiąt", "dziewięćdziesiąt")
    setki = Array("", "sto", "dwieście", "trzysta", "czterysta", "pięćset", "sześćset", _
                  "siedemset", "osiemset", "dziewięćset")
    Slowo = ""
    
    
        If Len(Liczba) - (Len(Liczba) \ 3) * 3 = 2 Then Liczba = "0" & Liczba
        If Len(Liczba) - (Len(Liczba) \ 3) * 3 = 1 Then Liczba = "00" & Liczba
        
        For i = 1 To (Len(Liczba) + 2) \ 3
          SlowoP = ""
          If i > 1 Then
            LiczbaP = Mid(Liczba, Len(Liczba) - (i * 3) + 1, 3)
          Else
            LiczbaP = Liczba
          End If
          
          If Right(LiczbaP, 2) < 20 Then
            SlowoP = Jednostki(Right(LiczbaP, 2)) & " " & SlowoP
          Else
            Slowo2 = dziesiatki(Left(Right(LiczbaP, 2), 1))
            Slowo2 = Slowo2 & " " & Jednostki(Right(LiczbaP, 1))
            SlowoP = Slowo2 & " " & SlowoP
          End If
          
          If LiczbaP > 99 Then
           SlowoP = setki(Left(Right(LiczbaP, 3), 1)) & " " & SlowoP
          End If
          
          Select Case i
           Case 1:  Przyrostki = Array(Waluta & " ", Waluta & " ", Waluta & " ")
           Case 2:  Przyrostki = Array("tysiąc ", "tysiące ", "tysięcy ")
           Case 3:  Przyrostki = Array("milion ", "miliony ", "milionów ")
           Case 4:  Przyrostki = Array("miliard ", "miliardy ", "miliardów ")
           Case 5:  Przyrostki = Array("bilion ", "biliony ", "bilionów ")
          End Select
          
           If LiczbaP  0 Then
             If LiczbaP = 1 Then
              Przyrostek = Przyrostki(0)
             Else
                If ((Right(LiczbaP, 1) > 1) And (Right(LiczbaP, 1) < 5)) Or _
                ((Right(LiczbaP, 2) > 21) And (Right(LiczbaP, 1) > 1) _
                And (Right(LiczbaP, 1) < 5)) Then Przyrostek = Przyrostki(1)
                If ((Right(LiczbaP, 2) > 4) And (Right(LiczbaP, 2) < 22)) Or _
                ((Right(LiczbaP, 2) > 21) And (Right(LiczbaP, 1) > 4) And (Right(LiczbaP, 1) < 22)) _
                Or (Right(LiczbaP, 1) = 0) Or (Right(LiczbaP, 1) = 1) Then Przyrostek = Przyrostki(2)
             End If
              Slowo = SlowoP & Przyrostek & Slowo
           End If
        Next i
        
    
    If Liczba = 0 And Grosze = "" Then Slowo = "zero" & Slowo & " " & Waluta
    
    If Grosze  "" Then Slowo = Slowo & IIf(Liczba = 0, "", "i ") & Grosze & " " & Waluta2
          
    Słownie = IIf(IsEmpty(Przedrostek), Slowo, Przedrostek & Slowo)
    
    
    
    
    
    End Function
  • #29 11169704
    jar_gogo
    Level 11  
    @ marek003
    terribly, but thank you so much :D

    Added after 1 [hours] 31 [minutes]:

    @AJaqubek
    Please find attached your file enriched with a macro @ marek003 and thanks to his help, I was able to help you too (of course, if you check and say that you meant it). The first is packed .xlsm with macro support (for execel 2007 and up). As the extension .xlsm is not allowed so far, I had to pack. The second is expansion .xls (for execel 2003).
    Narka
  • #30 11215041
    Antidotum ex
    Level 11  
    To AJaqubek
    Recently I was on vacation ...
    I am sending without VBA in your ver. see if he is passionate.
    As if it is best to say what it is about on an example
    kisses

Topic summary

The discussion revolves around converting numeric amounts to words in Excel, particularly for generating VAT invoices. Users share various methods, including using macros, user-defined functions, and external files. A commonly referenced solution involves a macro that can be integrated into Excel, allowing users to convert numbers into words with currency formatting. Several users provide links to resources, share their own macros, and discuss the functionality of existing solutions. Issues such as displaying currency correctly and ensuring compatibility across different Excel versions are also addressed. Users express a need for solutions that do not require VBA and can be easily implemented in their spreadsheets.
Summary generated by the language model.
ADVERTISEMENT