Condividi:        

Traduttore da Numeri a Lettere in Inglese

Hai problemi con i file Zip, vuoi formattare l'HD, non sai come funziona FireFox? O magari ti serve proprio quel programmino di cui non ricordi il nome! Ecco il forum dove poter risolvere i tuoi problemi.

Moderatori: Dylan666, hydra, gahan

Traduttore da Numeri a Lettere in Inglese

Postdi caponord » 30/09/05 20:30

Probabilmente ciò che cerco non esisterà, ho provato a cercarla coi motori di ricerca ma non c'è stato verso.
In sostanza per lavoro mi capita di dover scrivere un importo (un numero in pratica) in lettere in lingua inglese, per intenrci 10400 = tenthousandfourhundred etc etc
Dato che non sono una cima e cmq è importantissimo non sbagliare, avrei quindi bisogno di un sito dove mi faccia questa conversione, che poi poso copiare ed incollare in un file di testo.
Grazie 1.000 confido in voi:)
caponord
caponord
Utente Senior
 
Post: 371
Iscritto il: 02/12/02 19:36

Sponsor
 

Postdi archimede » 01/10/05 08:45

Puoi farlo con Excel. Inserisci il seguente codice in un modulo e poi usa la formula =english(<cella>) per convertire il numero presente nella cella indicata:
Codice: Seleziona tutto
' Convert an integer into an English string
Function english(ByVal N As Long) As String
    Const Thousand = 1000&
    Const Million = Thousand * Thousand
    Const Billion = Thousand * Million
    'Const Trillion = Thousand * Billion

    Dim Buf As String: Buf = ""

    Application.Volatile True
    If (N = 0) Then english = "zero": Exit Function

    If (N < 0) Then Buf = "negative ": N = -N

    If (N >= Billion) Then
        Buf = Buf & EnglishDigitGroup(N \ Billion) & " billion"
        N = N Mod Billion
        If (N) Then Buf = Buf & " "
    End If

    If (N >= Million) Then
        Buf = Buf & EnglishDigitGroup(N \ Million) & " million"
        N = N Mod Million
        If (N) Then Buf = Buf & " "
    End If

    If (N >= Thousand) Then
        Buf = Buf & EnglishDigitGroup(N \ Thousand) & " thousand"
        N = N Mod Thousand
        If (N) Then Buf = Buf & " "
    End If

    If (N > 0) Then
        Buf = Buf & EnglishDigitGroup(N)
    End If

    english = Buf
End Function
' Support function to be used only by English()
Private Function EnglishDigitGroup(ByVal N As Integer) As String
    Const Hundred = " hundred"
    Const One = "one"
    Const Two = "two"
    Const Three = "three"
    Const Four = "four"
    Const Five = "five"
    Const Six = "six"
    Const Seven = "seven"
    Const Eight = "eight"
    Const Nine = "nine"
    Dim Buf As String: Buf = ""
    Dim Flag As Integer: Flag = False

    'Do hundreds
    Select Case (N \ 100)
    Case 0: Buf = "":  Flag = False
    Case 1: Buf = One & Hundred: Flag = True
    Case 2: Buf = Two & Hundred: Flag = True
    Case 3: Buf = Three & Hundred: Flag = True
    Case 4: Buf = Four & Hundred: Flag = True
    Case 5: Buf = Five & Hundred: Flag = True
    Case 6: Buf = Six & Hundred: Flag = True
    Case 7: Buf = Seven & Hundred: Flag = True
    Case 8: Buf = Eight & Hundred: Flag = True
    Case 9: Buf = Nine & Hundred: Flag = True
    End Select

    If (Flag) Then N = N Mod 100
    If (N) Then
        If (Flag) Then Buf = Buf & " "
    Else
        EnglishDigitGroup = Buf
        Exit Function
    End If

    'Do tens (except teens)
    Select Case (N \ 10)
    Case 0, 1: Flag = False
    Case 2: Buf = Buf & "twenty": Flag = True
    Case 3: Buf = Buf & "thirty": Flag = True
    Case 4: Buf = Buf & "forty": Flag = True
    Case 5: Buf = Buf & "fifty": Flag = True
    Case 6: Buf = Buf & "sixty": Flag = True
    Case 7: Buf = Buf & "seventy": Flag = True
    Case 8: Buf = Buf & "eighty": Flag = True
    Case 9: Buf = Buf & "ninety": Flag = True
    End Select

    If (Flag) Then N = N Mod 10
    If (N) Then
        If (Flag) Then Buf = Buf & "-"
    Else
        EnglishDigitGroup = Buf
        Exit Function
    End If

    'Do ones and teens
    Select Case (N)
    Case 0: ' do nothing
    Case 1: Buf = Buf & One
    Case 2: Buf = Buf & Two
    Case 3: Buf = Buf & Three
    Case 4: Buf = Buf & Four
    Case 5: Buf = Buf & Five
    Case 6: Buf = Buf & Six
    Case 7: Buf = Buf & Seven
    Case 8: Buf = Buf & Eight
    Case 9: Buf = Buf & Nine
    Case 10: Buf = Buf & "ten"
    Case 11: Buf = Buf & "eleven"
    Case 12: Buf = Buf & "twelve"
    Case 13: Buf = Buf & "thirteen"
    Case 14: Buf = Buf & "fourteen"
    Case 15: Buf = Buf & "fifteen"
    Case 16: Buf = Buf & "sixteen"
    Case 17: Buf = Buf & "seventeen"
    Case 18: Buf = Buf & "eighteen"
    Case 19: Buf = Buf & "nineteen"
    End Select

    EnglishDigitGroup = Buf
End Function
HTH.

Alessandro
archimede
Moderatore
 
Post: 2851
Iscritto il: 07/11/02 12:41
Località: Genova

Postdi caponord » 01/10/05 09:04

Grazie 1000, purtroppo non sono un mostro manco in excel, o meglio lo so utilizzare anche a livello di formule ma mi fermo però li, con macro e moduli non mi sono mai addentrato.
Proverò con la guida ma alcune cose le trovo abbastanza complesse.
Io dovrei in effetti usarlo proprio con EXCEL.
Ciao e grazie ancora.
caponord
Utente Senior
 
Post: 371
Iscritto il: 02/12/02 19:36

Postdi archimede » 01/10/05 09:17

1) Apri Excel
2) Alt-F11
3) Inserisci --> Modulo
4) Incolla il codice
5) Torna in Excel
6) Usa la funzione (come indicato prima)

HTH.

Alessandro
archimede
Moderatore
 
Post: 2851
Iscritto il: 07/11/02 12:41
Località: Genova

Postdi caponord » 01/10/05 09:28

Perfetto, funziona, non avevo dubbi.
Due ultimissimi quesiti:

1. quindi il modulo resta memorizzato senza che debba fare nulla d'altro?

2. pensi sia possibile che non ci siano "spaziature" tra una parola e l'altra? avrei in sostanza bisogna di comportarmi come quando scrivo a lettere un importo su un assegno.

Grazie ancora anche a nome dei colleghi :)
caponord
caponord
Utente Senior
 
Post: 371
Iscritto il: 02/12/02 19:36

Postdi archimede » 01/10/05 09:40

caponord ha scritto:1. quindi il modulo resta memorizzato senza che debba fare nulla d'altro?
Hai provato? ;)
caponord ha scritto:2. pensi sia possibile che non ci siano "spaziature" tra una parola e l'altra?
Prova:
Codice: Seleziona tutto
' Convert an integer into an English string
Function english(ByVal N As Long) As String
    Const Thousand = 1000&
    Const Million = Thousand * Thousand
    Const Billion = Thousand * Million
    'Const Trillion = Thousand * Billion

    Dim Buf As String: Buf = ""

    Application.Volatile True
    If (N = 0) Then english = "zero": Exit Function

    If (N < 0) Then Buf = "negative ": N = -N

    If (N >= Billion) Then
        Buf = Buf & EnglishDigitGroup(N \ Billion) & "billion"
        N = N Mod Billion
    End If

    If (N >= Million) Then
        Buf = Buf & EnglishDigitGroup(N \ Million) & "million"
        N = N Mod Million
    End If

    If (N >= Thousand) Then
        Buf = Buf & EnglishDigitGroup(N \ Thousand) & "thousand"
        N = N Mod Thousand
    End If

    If (N > 0) Then
        Buf = Buf & EnglishDigitGroup(N)
    End If

    english = Buf
End Function
' Support function to be used only by English()
Private Function EnglishDigitGroup(ByVal N As Integer) As String
    Const Hundred = "hundred"
    Const One = "one"
    Const Two = "two"
    Const Three = "three"
    Const Four = "four"
    Const Five = "five"
    Const Six = "six"
    Const Seven = "seven"
    Const Eight = "eight"
    Const Nine = "nine"
    Dim Buf As String: Buf = ""
    Dim Flag As Integer: Flag = False

    'Do hundreds
    Select Case (N \ 100)
    Case 0: Buf = "":  Flag = False
    Case 1: Buf = One & Hundred: Flag = True
    Case 2: Buf = Two & Hundred: Flag = True
    Case 3: Buf = Three & Hundred: Flag = True
    Case 4: Buf = Four & Hundred: Flag = True
    Case 5: Buf = Five & Hundred: Flag = True
    Case 6: Buf = Six & Hundred: Flag = True
    Case 7: Buf = Seven & Hundred: Flag = True
    Case 8: Buf = Eight & Hundred: Flag = True
    Case 9: Buf = Nine & Hundred: Flag = True
    End Select

    If (Flag) Then N = N Mod 100
    If (N) Then
        'If (Flag) Then Buf = Buf & " "
    Else
        EnglishDigitGroup = Buf
        Exit Function
    End If

    'Do tens (except teens)
    Select Case (N \ 10)
    Case 0, 1: Flag = False
    Case 2: Buf = Buf & "twenty": Flag = True
    Case 3: Buf = Buf & "thirty": Flag = True
    Case 4: Buf = Buf & "forty": Flag = True
    Case 5: Buf = Buf & "fifty": Flag = True
    Case 6: Buf = Buf & "sixty": Flag = True
    Case 7: Buf = Buf & "seventy": Flag = True
    Case 8: Buf = Buf & "eighty": Flag = True
    Case 9: Buf = Buf & "ninety": Flag = True
    End Select

    If (Flag) Then N = N Mod 10
    If (N) Then
        If (Flag) Then Buf = Buf & "-"
    Else
        EnglishDigitGroup = Buf
        Exit Function
    End If

    'Do ones and teens
    Select Case (N)
    Case 0: ' do nothing
    Case 1: Buf = Buf & One
    Case 2: Buf = Buf & Two
    Case 3: Buf = Buf & Three
    Case 4: Buf = Buf & Four
    Case 5: Buf = Buf & Five
    Case 6: Buf = Buf & Six
    Case 7: Buf = Buf & Seven
    Case 8: Buf = Buf & Eight
    Case 9: Buf = Buf & Nine
    Case 10: Buf = Buf & "ten"
    Case 11: Buf = Buf & "eleven"
    Case 12: Buf = Buf & "twelve"
    Case 13: Buf = Buf & "thirteen"
    Case 14: Buf = Buf & "fourteen"
    Case 15: Buf = Buf & "fifteen"
    Case 16: Buf = Buf & "sixteen"
    Case 17: Buf = Buf & "seventeen"
    Case 18: Buf = Buf & "eighteen"
    Case 19: Buf = Buf & "nineteen"
    End Select

    EnglishDigitGroup = Buf
End Function
HTH.

Alessandro
archimede
Moderatore
 
Post: 2851
Iscritto il: 07/11/02 12:41
Località: Genova

Postdi caponord » 01/10/05 10:54

Si ho provato, ma se chiudo excel e riapro quel modulo è come se non ci fosse e quindi la conversione non funziona.

Il modulo va forse salvato? Sorry ma non ne sapevo manco esistessero i moduli :)

Ultimo livello di difficoltà, mi spiace non averci pensato prima, ma questo non credo isa possibile, avrei necessità che al termine delle parole mettesse "/xx", in sostanza che venissero indicati, in numero, i centesimi.

Esempio: Euro 100,35 = onehundred/35

Grazieeeeeeeee
caponord
caponord
Utente Senior
 
Post: 371
Iscritto il: 02/12/02 19:36

Postdi archimede » 01/10/05 11:27

Codice: Seleziona tutto
' Convert an integer into an English string
Function english(ByVal dbl As Double) As String
    Const Thousand = 1000&
    Const Million = Thousand * Thousand
    Const Billion = Thousand * Million
    'Const Trillion = Thousand * Billion

    Dim Buf As String: Buf = ""
    Dim N As Long
    Dim dec As String: dec = ""

    Application.Volatile True
    If (dbl = 0) Then english = "zero": Exit Function

    If (dbl < 0) Then Buf = "negative "

    N = Int(Abs(dbl))
    dec = Mid(CStr(dbl), InStr(CStr(dbl) & ",", ",") + 1)

    If (N >= Billion) Then
        Buf = Buf & EnglishDigitGroup(N \ Billion) & "billion"
        N = N Mod Billion
        'If (N) Then Buf = Buf & " "
    End If

    If (N >= Million) Then
        Buf = Buf & EnglishDigitGroup(N \ Million) & "million"
        N = N Mod Million
        'If (N) Then Buf = Buf & " "
    End If

    If (N >= Thousand) Then
        Buf = Buf & EnglishDigitGroup(N \ Thousand) & "thousand"
        N = N Mod Thousand
        'If (N) Then Buf = Buf & " "
    End If

    If (N > 0) Then
        Buf = Buf & EnglishDigitGroup(N)
    End If

    If (dec > "") Then
        Buf = Buf & "/" & dec
    End If

    english = Buf
End Function
' Support function to be used only by English()
Private Function EnglishDigitGroup(ByVal N As Integer) As String
    Const Hundred = "hundred"
    Const One = "one"
    Const Two = "two"
    Const Three = "three"
    Const Four = "four"
    Const Five = "five"
    Const Six = "six"
    Const Seven = "seven"
    Const Eight = "eight"
    Const Nine = "nine"
    Dim Buf As String: Buf = ""
    Dim Flag As Integer: Flag = False

    'Do hundreds
    Select Case (N \ 100)
    Case 0: Buf = "":  Flag = False
    Case 1: Buf = One & Hundred: Flag = True
    Case 2: Buf = Two & Hundred: Flag = True
    Case 3: Buf = Three & Hundred: Flag = True
    Case 4: Buf = Four & Hundred: Flag = True
    Case 5: Buf = Five & Hundred: Flag = True
    Case 6: Buf = Six & Hundred: Flag = True
    Case 7: Buf = Seven & Hundred: Flag = True
    Case 8: Buf = Eight & Hundred: Flag = True
    Case 9: Buf = Nine & Hundred: Flag = True
    End Select

    If (Flag) Then N = N Mod 100
    If (N) Then
        'If (Flag) Then Buf = Buf & " "
    Else
        EnglishDigitGroup = Buf
        Exit Function
    End If

    'Do tens (except teens)
    Select Case (N \ 10)
    Case 0, 1: Flag = False
    Case 2: Buf = Buf & "twenty": Flag = True
    Case 3: Buf = Buf & "thirty": Flag = True
    Case 4: Buf = Buf & "forty": Flag = True
    Case 5: Buf = Buf & "fifty": Flag = True
    Case 6: Buf = Buf & "sixty": Flag = True
    Case 7: Buf = Buf & "seventy": Flag = True
    Case 8: Buf = Buf & "eighty": Flag = True
    Case 9: Buf = Buf & "ninety": Flag = True
    End Select

    If (Flag) Then N = N Mod 10
    If (N) Then
        If (Flag) Then Buf = Buf & "-"
    Else
        EnglishDigitGroup = Buf
        Exit Function
    End If

    'Do ones and teens
    Select Case (N)
    Case 0: ' do nothing
    Case 1: Buf = Buf & One
    Case 2: Buf = Buf & Two
    Case 3: Buf = Buf & Three
    Case 4: Buf = Buf & Four
    Case 5: Buf = Buf & Five
    Case 6: Buf = Buf & Six
    Case 7: Buf = Buf & Seven
    Case 8: Buf = Buf & Eight
    Case 9: Buf = Buf & Nine
    Case 10: Buf = Buf & "ten"
    Case 11: Buf = Buf & "eleven"
    Case 12: Buf = Buf & "twelve"
    Case 13: Buf = Buf & "thirteen"
    Case 14: Buf = Buf & "fourteen"
    Case 15: Buf = Buf & "fifteen"
    Case 16: Buf = Buf & "sixteen"
    Case 17: Buf = Buf & "seventeen"
    Case 18: Buf = Buf & "eighteen"
    Case 19: Buf = Buf & "nineteen"
    End Select

    EnglishDigitGroup = Buf
End Function
Per quel che riguarda il salvataggio, non so che dirti: se io chiudo (salvando) il mio foglio di Excel (97) e lo riapro mi chiede se voglio attivare le macro, dico di sì e tutto funziona come previsto.

HTH.

Alessandro
archimede
Moderatore
 
Post: 2851
Iscritto il: 07/11/02 12:41
Località: Genova

Postdi caponord » 01/10/05 12:59

Ok, pensavo fosse un modulo che in sostanza andasse ad aggiungere un nuovo tipo di formula, che poi fosse disponibile anche per altri files. Va benissimo così.

Per quanto riguarda il codice la "/" ed i centesimi me li da perfettamente, però mi traduce così:

97,07 = ninety-seven/07

stranamente separa con un "trattino" la parola "ninety" e "seven", ma non lo fa con tutti i numeri, esempio:

105 = onehundredfive (senza trattino)

Grazie ancora, siete davvero in gamba.
caponord
caponord
Utente Senior
 
Post: 371
Iscritto il: 02/12/02 19:36

Postdi archimede » 01/10/05 13:07

Se non vuoi il trattino metti un apice singolo davanti a 'If (Flag) Then Buf = Buf & "-".

Alessandro
archimede
Moderatore
 
Post: 2851
Iscritto il: 07/11/02 12:41
Località: Genova

Postdi Dylan666 » 01/10/05 13:45

cose già fatte:

http://ukww.net/patools/

http://www.bygsoftware.com/examples/examples.htm

In tette le pagina cerca la frase "numbers to words" che è stata la mia chiave di ricerca su Google:
http://www.google.it/search?q=euro++%22 ... o+words%22
Avatar utente
Dylan666
Moderatore
 
Post: 39994
Iscritto il: 18/11/03 16:46

Postdi dado » 01/10/05 14:08

Dylan666 ha scritto:In tette


Lapsus foidiano, dylan? :lol:

House: "Vede, tutti pensano che sia un paziente a causa del bastone"
Wilson: "Allora perchè non indossa un camice bianco come tutti noi?"
House: "Perchè altrimenti pensano che sia un medico".
Avatar utente
dado
Utente Senior
 
Post: 16208
Iscritto il: 21/08/01 01:00
Località: La Città dei Sette Assedi

Postdi caponord » 01/10/05 23:14

archimede ha scritto:Se non vuoi il trattino metti un apice singolo davanti a 'If (Flag) Then Buf = Buf & "-".

Alessandro


Perfetto Archimede, mi sa che ersta un solo piccolissimo dettaglio, il ",10" lo traduce in lettere in ",1" anzichè ",10".

Proverei io ad adattare la cosa ma non so manco da che parte iniziare :)

Grazie a DYLAN, nelle ricerche con i motori devo abituarmi a ragionare in inglese, perchè se cerco con "traduttore parole numeri" esce davvero poco o nulla.

Grazie a tutti.
caponord
caponord
Utente Senior
 
Post: 371
Iscritto il: 02/12/02 19:36

Postdi Dylan666 » 02/10/05 01:12

caponord ha scritto:Grazie a DYLAN, nelle ricerche con i motori devo abituarmi a ragionare in inglese, perchè se cerco con "traduttore parole numeri" esce davvero poco o nulla.


Non è una questione di lingua. Ho provato ora con l'italiano:
http://www.google.it/search?q=%22numeri+in+parole%22

Il primo risultato è questo:
http://office.microsoft.com/it-it/offic ... 31040.aspx

E da quella lista si arriva qui:
http://www.microsoft.com/downloads/deta ... laylang=it

Basta che ne scarichi la versione in Inglese e dovresti avere quello che ti serviva ;)
Avatar utente
Dylan666
Moderatore
 
Post: 39994
Iscritto il: 18/11/03 16:46

Postdi caponord » 02/10/05 10:45

Ciao Dylan, allora sbagliavo la chiave di ricerca, devo avere più fantasia, cercavamo con "traduttore cifre numeri" e basta.
Peccato che quell'EXE da scaricare sia per word2002, io l'avrei bisogno per Excel2003, ma cmq con quella macro ho risolto alla grande, resta solo quel picoclo dettaglio.
Ciao e grazie ancora
caponord
Utente Senior
 
Post: 371
Iscritto il: 02/12/02 19:36

Postdi archimede » 03/10/05 08:21

caponord ha scritto:un solo piccolissimo dettaglio, il ",10" lo traduce in lettere in ",1" anzichè ",10".
Aggiungi
Codice: Seleziona tutto
    If (Len(dec) = 1) Then dec = dec & "0"
dopo la riga
Codice: Seleziona tutto
    If (dec > "") Then
HTH.

Alessandro
archimede
Moderatore
 
Post: 2851
Iscritto il: 07/11/02 12:41
Località: Genova

Re: Traduttore da Numeri a Lettere in Inglese

Postdi vesuvio38 » 25/07/14 17:08

Salve,

uso il file exel con la formula indicata da tempo e con successo. E' possibile che il risultato in lettere sia leggibile con le maiuscole e non con le minuscole?

Infine, quando si indica un numero del tipo xxxx,10 il risultato esce senza lo 0.

Si può risolvere? grz

domenico
vesuvio38
Newbie
 
Post: 1
Iscritto il: 25/07/14 17:05

Re: Traduttore da Numeri a Lettere in Inglese

Postdi Dylan666 » 20/08/14 10:17

Per la prima domanda, basta che nel codice tu sostitusica le parole in inglese tra virgolette nel corrispettivo in maiuscolo.

es:
Buf = Buf & EnglishDigitGroup(N \ Billion) & " BILLION"

Per la seconda domanda, hai letto l'intervento sopra al tuo?
Avatar utente
Dylan666
Moderatore
 
Post: 39994
Iscritto il: 18/11/03 16:46

Re: Traduttore da Numeri a Lettere in Inglese

Postdi ddelsorbo » 18/08/15 17:07

Ho letto la tua risposta solo ora, dopo esattamente un anno! Ho risolto e ti ringrazio molto.

Domenico
ddelsorbo
Newbie
 
Post: 1
Iscritto il: 18/08/15 17:05


Torna a Software Windows


Topic correlati a "Traduttore da Numeri a Lettere in Inglese":


Chi c’è in linea

Visitano il forum: Nessuno e 100 ospiti