A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

EXCEL:NUMBER TO GREEK WORDS



 
 
Thread Tools Display Modes
  #1  
Old June 15th, 2005, 02:46 PM
vag
external usenet poster
 
Posts: n/a
Default EXCEL:NUMBER TO GREEK WORDS

hi
Does anybody know how to convert numbers in greek text?
  #2  
Old June 15th, 2005, 05:57 PM
vag
external usenet poster
 
Posts: n/a
Default


The problem is that in greek numbers hundreds follow the rule of tens,
but without distiction. I've tried to solve this but couldn't work it
out. Also one thousand does not follow the rule of two thousand, three
thousand etc.
If anyone can help me please reply
Thanks
vag

PS below is the code from microsoft,modified by me. works until 100
then...


Option Explicit
'Main Function
Function SpellNumber(ByVal MyNumber)
Dim ευρώ, Cents, Temp
Dim DecimalPlace, Count
ReDim Place(9) As String
Place(2) = " χιλιάδες "
Place(3) = "
εκατομύρια "
Place(4) = "
δισεκατομύρια
"
Place(5) = "
τρισεκατομύρια
"
' String representation of amount.
MyNumber = Trim(Str(MyNumber))
' Position of decimal place 0 if none.
DecimalPlace = InStr(MyNumber, ".")
' Convert cents and set MyNumber to dollar amount.
If DecimalPlace 0 Then
Cents = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & _
"00", 2))
MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))
End If
Count = 1
Do While MyNumber ""
Temp = GetHundreds
If Temp "" Then ευρώ = Temp &
Place(Count) & ευρώ
If Len(MyNumber) 3 Then
MyNumber = Left(MyNumber, Len(MyNumber) - 3)
Else
MyNumber = ""
End If
Count = Count + 1
Loop
Select Case ευρώ
Case ""
ευρώ = ""
Case "One"
ευρώ = "ένα
ευρώ"
Case Else
ευρώ = ευρώ & "
ευρώ"
End Select
Select Case Cents
Case ""
Cents = ""
Case "One"
Cents = " and ένα
λεπτό"
Case Else
Cents = " and " & Cents & "
λεπτά"
End Select
SpellNumber = ευρώ & Cents
End Function

' Converts a number from 100-999 into text
Function GetHundreds(HundredsText)
Dim Result As String
Result = "" ' Null out the temporary function value.
If Val(Left(HundredsText, 2)) Then
Select Case Val(HundredsText)
Case 100: Result = "εκατό"
Case 200: Result =
"διακόσια"
Case 300: Result =
"τριακόσια"
Case 400: Result =
"τετρακόσια"
Case 500: Result =
"πεντακόσια"
Case 600: Result =
"εξακόσια"
Case 700: Result =
"επτακόσια"
Case 800: Result =
"οκτακόσια"
Case 900: Result =
"εννιακόσια"
Case Else
End Select
Result = Result & GetTens & GetDigit _
End If
GetHundreds = Result
End Function


' Converts a number from 10 to 99 into text.
Function GetTens(TensText)
Dim Result As String
Result = "" ' Null out the temporary function value.
If Val(Left(TensText, 1)) = 1 Then ' If value between 10-19...
Select Case Val(TensText)
Case 10: Result = "δέκα"
Case 11: Result = "έντεκα"
Case 12: Result = "δώδεκα"
Case 13: Result =
"δεκατρία"
Case 14: Result =
"δεκατέσσερα"
Case 15: Result =
"δεκαπέντε"
Case 16: Result =
"δεκαέξι"
Case 17: Result =
"δεκαεπτά"
Case 18: Result =
"δεκαοκτώ"
Case 19: Result =
"δεκαεννέα"
Case Else
End Select
Else ' If value between 20-99...
Select Case Val(Left(TensText, 1))
Case 2: Result = "είκοσι "
Case 3: Result =
"τριάντα "
Case 4: Result =
"σαράντα "
Case 5: Result =
"πενήντα "
Case 6: Result = "εξήντα "
Case 7: Result =
"εβδομήντα "
Case 8: Result =
"ογδόντα "
Case 9: Result =
"ενενήντα "
Case Else
End Select
Result = Result & GetDigit _
(Right(TensText, 1)) ' Retrieve ones place.
End If
GetTens = Result
End Function

' Converts a number from 1 to 9 into text.
Function GetDigit(Digit)
Select Case Val(Digit)
Case 1: GetDigit = "ένα"
Case 2: GetDigit = "δύο"
Case 3: GetDigit = "τρία"
Case 4: GetDigit =
"τέσσερα"
Case 5: GetDigit = "πέντε"
Case 6: GetDigit = "έξι"
Case 7: GetDigit = "επτά"
Case 8: GetDigit = "οκτώ"
Case 9: GetDigit = "εννιά"
Case Else: GetDigit = ""
End Select
End Function


--
vag
------------------------------------------------------------------------
vag's Profile: http://www.excelforum.com/member.php...o&userid=24328
View this thread: http://www.excelforum.com/showthread...hreadid=379340

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Number to words literal JCP Worksheet Functions 12 August 22nd, 2008 05:18 PM
How can I find if there are doubles in my list of words? Rhen General Discussion 3 June 9th, 2005 05:12 AM
Word frequencies Anthea General Discussion 6 January 10th, 2005 04:46 AM
Word Count mel General Discussion 2 December 14th, 2004 10:17 PM
Unique Wordcount Frank General Discussion 3 June 1st, 2004 01:54 PM


All times are GMT +1. The time now is 04:05 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.