안녕하세요. 오즈맨 입니다.
 시트명은 Sheet1 입니다.
[ 숫자를 영어로 나타내는 사용자 함수 (NUM2DOLLAR) ] 예제 입니다.
   예제 - 1 NUM2DOLLAR (숫자)
   기본 화폐 단위 = 달러
   예제 - 2 NUM2DOLLAR (숫자, "fran")
 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
30 
31 
32 
33 
34 
35 
A B C D E
      1 One Dollar.
      109 One Hundred Nine Dollars.
      218 Two Hundred Eighteen Dollars.
      326 Three Hundred Twenty Six Dollars.
      435 Four Hundred Thirty Five Dollars.
      1,443 One Thousand Four Hundred Forty Three Dollars.
      2,452 Two Thousand Four Hundred Fifty Two Dollars.
      12,460 Twelve Thousand Four Hundred Sixty Dollars.
      22,469 Twenty Two Thousand Four Hundred Sixty Nine Dollars.
      30,000 Thirty Thousand Dollars.
      30,003 Thirty Thousand Three Dollars.
      40,000 Forty Thousand Dollars.
      50,009 Fifty Thousand Nine Dollars.
      7,000,015 Seven Million Fifteen Dollars.
      7,001,015 Seven Million One Thousand Fifteen Dollars.
    1 One Dollar.
    109.01 One Hundred Nine Dollars and One Cents.
    218.02 Two Hundred Eighteen Dollars and Two Cents.
    326.08 Three Hundred Twenty Six Dollars and Eight Cents.
    435.09 Four Hundred Thirty Five Dollars and Nine Cents.
    1,043.10 One Thousand Forty Three Dollars and Ten Cents.
    2,052.91 Two Thousand Fifty Two Dollars and Ninety One Cents.
    12,060.00 Twelve Thousand Sixty Dollars.
    22,069.01 Twenty Two Thousand Sixty Nine Dollars and One Cents.
    30,010.02 Thirty Thousand Ten Dollars and Two Cents.
    30,013.08 Thirty Thousand Thirteen Dollars and Eight Cents.
    7,001,005.11 Seven Million One Thousand Five Dollars and Eleven Cents.
    7,001,015.11 Seven Million One Thousand Fifteen Dollars and Eleven Cents.
  102.1333 One Hundred Two Dollars and Thirteen Cents and Three Three.
  102.2536 One Hundred Two Dollars and Twenty Five Cents and Three Six.
  102.9042 One Hundred Two Dollars and Ninety Cents and Four Two.
  110.1351 One Hundred Ten Dollars and Thirteen Cents and Five One.
  200.1354 Two Hundred Dollars and Thirteen Cents and Five Four.
1 One franc.
109 One Hundred Nine franc's.


Sheet1
시트 에 사용한 수식
입니다. by MicroSoft Excel v 2003
   $ 가 있는 수식은 절대(혼합)참조로 셀 주소를 고정합니다. 참조하세요!!
No 셀주소 왼쪽의 셀에 수식을 넣으면 오른쪽 결과가 나옵니다.
(복사)를 누르면 셀의 수식이 클립보드(메모리)로 복사되는데,
익스플로러의 종류에 따라 (복사)가 작동이 안 될 수 있습니다.
결과 수식을
1 E1 =NUM2DOLLAR(D1) One Dollar.
2   E1  셀의 수식을 여기에 복사하세요 -→ E1:E15    
3 E16 =NUM2DOLLAR(C16) One Dollar.
4   E16  셀의 수식을 여기에 복사하세요 -→ E16:E28    
5 E29 =NUM2DOLLAR(B29) One Hundred Two Dollars and
Thirteen Cents and Three Three.
6   E29  셀의 수식을 여기에 복사하세요 -→ E29:E33    
7 E34 =NUM2DOLLAR(A34,"franc") One franc.
8   E34  셀의 수식을 여기에 복사하세요 -→ E34:E35    

   보시는 내용은 위의 표에 값이, 아래의 표에는 해당 셀의 수식이 있습니다.   
   첨부파일을 참조하시거나, 원하는 부분을 시트(셀)에 붙여 넣으세요.

     도움이 되시기를 바랍니다.
수식에 사용자 정의 함수가 있습니다. 다른 파일에서는 안 될 수 있습니다.
  주) 사용자 정의 함수를 많은 셀에 사용하면 버벅거릴 수 있습니다.
사용자 정의 함수를 사용했던 영역은 그 영역을 복사한 다음
편집/메뉴에서 선택하여 붙여넣기를 선택, 값으로 변환하는 것이 좋습니다.사용자 함수 만들기 입니다. [ 클릭 ]


Option Explicit

Function NUM2DOLLAR(WhatsNumber As Double, Optional MoneyType As String = "Dollar")' === 모듈 시작
' CodeBy [ 오즈맨 ] , Date : 2008-09-09
Dim iLoop As Integer               'Loop
Dim CommaNumbr(1 To 5) As String   'Share by 3 Digit
Dim StrngNum_1 As String           'String Number to Format 000 000...
Dim StrngNum_2 As String           'String Number of Decimal
Dim WorkNumber As Variant          '000 000... Split
Dim NumInt     As String           'Number Integer
Dim NumDec     As String           'Decimal Number
Dim PosDot     As Integer
Dim PosDec     As Integer
Dim DecCent    As String

On Error Resume Next
     CommaNumbr(1) = " Trillion ": CommaNumbr(2) = " Billion "
     CommaNumbr(3) = " Million ":  CommaNumbr(4) = " Thousand "
     
PosDot = InStr(WhatsNumber, ".")

If WhatsNumber = 0 Then
          NUM2DOLLAR = "No Dollar."
     If MoneyType <> "Dollar" Then
          NUM2DOLLAR = Replace(NUM2DOLLAR, "Dollar", MoneyType)
     End If
          Exit Function
ElseIf WhatsNumber = 1 Then
          NUM2DOLLAR = "One Dollar."
     If MoneyType <> "Dollar" Then
          NUM2DOLLAR = Replace(NUM2DOLLAR, "Dollar", MoneyType)
     End If
          Exit Function

End If

If PosDot = 0 Then
     StrngNum_1 = Format(WhatsNumber, " 000 000 000 000 000")
Else
     StrngNum_1 = Format(Left(WhatsNumber, PosDot - 1), " 000 000 000 000 000")
     StrngNum_2 = Mid(WhatsNumber, PosDot + 1)
     PosDec = Len(StrngNum_2)
End If
     WorkNumber = Split(StrngNum_1)

For iLoop = 1 To UBound(WorkNumber)
     If WorkNumber(iLoop) <> "000" Then
     NumInt = NumInt & String_1(Left(WorkNumber(iLoop), 1)) & String_2(Right(WorkNumber(iLoop), 2)) & CommaNumbr(iLoop)
     End If
Next

If NumInt = "" Then
     NumInt = "Zero Dollar"
Else
     NumInt = NumInt & " Dollars "
End If

     If PosDot = 0 Then
          NUM2DOLLAR = NumInt
     Else
          If PosDec = 1 Then
                    NUM2DOLLAR = NumInt & " and " & String_2(StrngNum_2 & "0") & " Cents "
          ElseIf PosDec = 2 Then
                    NUM2DOLLAR = NumInt & " and " & String_2(StrngNum_2) & " Cents "
          Else
               DecCent = Left(StrngNum_2, 2)
               If DecCent = "00" Then
                    NumDec = String_2(DecCent) & " NoCent "
               Else
                    NumDec = String_2(DecCent) & " Cents and"
               End If
               For iLoop = 3 To PosDec
                    If Mid(StrngNum_2, iLoop, 1) = "0" Then
                    NumDec = NumDec & " Zero"
                    Else
                    NumDec = NumDec & " " & String_3(Mid(StrngNum_2, iLoop, 1))
                    End If
               Next
                    NumDec = NumDec & " "
                    NUM2DOLLAR = NumInt & " and " & NumDec
          End If
     End If
     
     NUM2DOLLAR = RTrim(Replace(NUM2DOLLAR, "  ", " "))
If MoneyType <> "Dollar" Then
     NUM2DOLLAR = Replace(NUM2DOLLAR, "Dollar", MoneyType & "'")
     'If Want "francs" Instead of "franc's" then
     'Use This
     'NUM2Dollar = Replace(NUM2Dollar, "Dollar", MoneyType)
End If
     NUM2DOLLAR = NUM2DOLLAR & "."
End Function         ' ___ 모듈 종료

Function String_1(MyString As String) ' 100's Number' === 모듈 시작
' CodeBy [ 오즈맨 ] , Date :
2008-09-09
If MyString <> "0" Then
     String_1 = String_3(MyString) & " Hundred "
End If
End Function         ' ___ 모듈 종료

Function String_2(MyString As String) ' 10's Number (20-90)' === 모듈 시작
' CodeBy [ 오즈맨 ] , Date :
2008-09-09
Select Case Left(MyString, 1)
     Case "1"
          String_2 = String_21(MyString)
          Exit Function
     Case "2": String_2 = "Twenty ":    Case "3": String_2 = "Thirty "
     Case "4": String_2 = "Forty ":     Case "5": String_2 = "Fifty "
     Case "6": String_2 = "Sixty ":     Case "7": String_2 = "Seventy "
     Case "8": String_2 = "Eighty ":    Case "9": String_2 = "Ninety "
End Select
          String_2 = String_2 & String_3(Right(MyString, 1))
End Function         ' ___ 모듈 종료

Function String_21(MyString As String) ' 10-19's Number' === 모듈 시작
' CodeBy [ 오즈맨 ] , Date :
2008-09-09
Select Case MyString
     Case "10": String_21 = "Ten":      Case "11": String_21 = "Eleven"
     Case "12": String_21 = "Twelve":   Case "13": String_21 = "Thirteen"
     Case "14": String_21 = "Fourteen": Case "15": String_21 = "Fifteen"
     Case "16": String_21 = "Sixteen":  Case "17": String_21 = "Seventeen"
     Case "18": String_21 = "Eighteen": Case "19": String_21 = "Nineteen"
End Select
End Function         ' ___ 모듈 종료

Function String_3(MyString As String) ' 1-9's Number' === 모듈 시작
' CodeBy [ 오즈맨 ] , Date :
2008-09-09
Select Case MyString
     Case "1": String_3 = "One":        Case "2": String_3 = "Two"
     Case "3": String_3 = "Three":      Case "4": String_3 = "Four"
     Case "5": String_3 = "Five":       Case "6": String_3 = "Six"
     Case "7": String_3 = "Seven":      Case "8": String_3 = "Eight"
     Case "9": String_3 = "Nine"
End Select
End Function         ' ___ 모듈 종료
첨부파일
  
Posted by 오즈맨스머프