April 26, 2017
I need a code to write out currency values as words in Portuguese (Pt). I’ve managed to adapt from this code somewhat from the spanish version which is close enough but there are some specifics i need further assistance with (my version is attached).
Numbers are written out differently in portuguese and it's not straight forward to adapt from En to Pt, or even from Spanish to Pt (for me anyway...).
1) The number 100 on its own is "Cem", except a couple of special cases, the hundreds all have "centos" at the end, e.g. "quatrocentos = 400", etc. The code handles these cases fine. But then, there's the case of numbers between 101 and 199 (all inclusive) where the hundred becomes "cento" and not "cem", the current code returns "cem e vinte" for 120 but it should in fact be "cento e vinte"
2) I need to be able to output an “and” between number levels, i.e. 1 200 as “one thousand and two hundred”; 1 520 110 as one million and five hundred and twenty thousand and one hundred and ten… you get the idea…? but i still need a plain "two hundred" from "200"
(and in portuguese is "e"; i've managed to add this to the hundreds and tens position with this line which i edited from the spanish code:
If Val(Right(TensText, 1)) <> 0 Then Result = Result & "e " 'When no whole tens
with the above i get 41 as "forty and one" which is what I need.
Problem: I still need to get the "e" to come up between the trillions, millions, thousands, while still also getting normal numbers for each of these levels, i.e. just adding the "and" in the case arguements as below wont work because i still need to have just "eleven" etc. on their own as well.
Case 10: Result = "And Ten"
Case 11: Result = "And Eleven"
Case 12: Result = "And Twelve"
Case 13: Result = "And Thirteen"
Case 14: Result = "And Fourteen"
Case 15: Result = "And Fifteen"
Case 16: Result = "And Sixteen"
Case 17: Result = "And Seventeen"
Case 18: Result = "And Eighteen"
Case 19: Result = "And Nineteen"
3) I need to differentiate singular and plural forms of thousands, millions etc.
i.e. one million, two millions… and so on.
so anyway, here is the whole code (attached).
November 8, 2013
Try the attached version. The initial code is not designed for so many variations and It's very hard to understand how it should be without manual examples.
Please prepare a list of special cases, and compare what the code returns to what it should be. Make sure you cover all special cases, with clear examples.
Most Users Ever Online: 57
Currently Online: Catalin Bombea
Currently Browsing this Page:
Frans Visser: 210
mey tithveasna: 71
Anders Sehlstedt: 47
Mohamed Rehan Memon
Guest Posters: 1
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea
Moderators: Genevieve Tupas