Skip to main content

在 Excel 中將數字轉換為文字 – 完整指南

Author: Xiaoyang Last Modified: 2025-08-06

將數字轉換為書寫文字通常用於財務報告、法律文件、發票或支票。雖然 Excel 本身不提供此功能,但有幾種可靠的方法可以實現,從內建的 Microsoft 365 函數到 VBA 使用者自訂函數以及強大的第三方外掛程式。這份完整指南將帶您了解每種方法,突出它們的優缺點,並幫助您選擇最適合您特定需求的方法。

A screenshot showing converting numbers to words in Excel

在 Excel 中將數字轉換為文字的方法

本節介紹了三種將貨幣數字轉換為文字的有效方法。選擇最符合您的 Excel 版本和使用情況的方法。


方法 1:使用新的內建函數(僅限 Microsoft 365)

如果您使用的是 Microsoft 365 的 Excel,您可以利用新的 TRANSLATE 函數,透過創意公式組合輕鬆地將貨幣數字轉換為文字。

如下方截圖所示,要將範圍 A2:A5 中的貨幣數字轉換為文字,您可以應用以下公式來完成。

  1. 選擇一個空白單元格(例如 B2),輸入下方公式。
    =PROPER(SUBSTITUTE(SUBSTITUTE(LOWER(TRANSLATE(BAHTTEXT(B9),"th","en")),"baht","dollars"),"satang","cents"))
  2. 按下「Enter」鍵並將「填滿控制點」向下拖動以應用於其他行。
    A screenshot showing how to use the new function to convert numbers to words

公式的工作原理:

  • BAHTTEXT: 將數字轉換為泰銖文字(例如,“หนึ่งบาทถ้วน”)。
  • TRANSLATE(...,"th","en"): 將文字從一種語言翻譯成另一種語言(需要 Microsoft 365)。在此例子中,它將泰語翻譯成英文。
  • LOWER(): 將整個字符串轉換為小寫以保持一致性。
  • SUBSTITUTE(): 替換貨幣詞語如“baht”和“satang”為您所需的術語。
  • PROPER(): 將每個單詞的第一個字母大寫以進行適當格式化。

適應其他貨幣:

上述公式輸出美元。您可以通過替換主要和次要單位來自定義其他貨幣:

  • 將“dollars”替換為目標貨幣的主要單位,例如英鎊的“pounds”。
  • 將“cents”替換為次要單位,例如英鎊的“pence”。

下表列出了兼容的貨幣及其對應的公式:

貨幣主要單位替換次要單位替換範例公式(假設值在單元格 A2 中)
USD dollars cents =PROPER(SUBSTITUTE(SUBSTITUTE(LOWER(TRANSLATE(BAHTTEXT(A2),"th","en")),"baht","dollars"),"satang","cents"))
GBP pounds pence =PROPER(SUBSTITUTE(SUBSTITUTE(LOWER(TRANSLATE(BAHTTEXT(A2),"th","en")),"baht","pounds"),"satang","pence"))
EUR euros cents =PROPER(SUBSTITUTE(SUBSTITUTE(LOWER(TRANSLATE(BAHTTEXT(A2),"th","en")),"baht","euros"),"satang","cents"))
MYR ringgit sen =PROPER(SUBSTITUTE(SUBSTITUTE(LOWER(TRANSLATE(BAHTTEXT(A2),"th","en")),"baht","ringgit"),"satang","sen"))

此方法的限制:

  • 僅在 Microsoft 365 的 Excel 中有效(由於 TRANSLATE() 函數)。
  • 輸出高度依賴 BAHTTEXT() 格式的準確性。
  • 此方法適用於像泰銖那樣具有主要單位和次要單位(例如美元和美分)的貨幣。不建議用於不遵循類似貨幣結構的貨幣。

方法 2:使用 VBA 使用者自訂函數

在本節中,您將學習如何使用基於 VBA 的使用者自訂函數 (UDF) 將數值轉換為英文貨幣文字——特別是默認針對美國美元 (USD) 定製。

步驟 1:插入 VBA 程式碼

  1. 打開您希望使用此功能的工作表。
  2. 按 “Alt” + “F11” 打開 “Microsoft Visual Basic for Applications” 視窗。
  3. 在編輯器中,點擊 “插入” > “模塊”,並粘貼以下 VBA 程式碼。
    Function SpellNumberToEnglish(ByVal pNumber)
    'Update by Extendoffice
    Dim Dollars, Cents
    arr = Array("", "", " Thousand ", " Million ", " Billion ", " Trillion ")
    pNumber = Trim(Str(pNumber))
    xDecimal = InStr(pNumber, ".")
    If xDecimal > 0 Then
        Cents = GetTens(Left(Mid(pNumber, xDecimal + 1) & "00", 2))
        pNumber = Trim(Left(pNumber, xDecimal - 1))
    End If
    xIndex = 1
    Do While pNumber <> ""
        xHundred = ""
        xValue = Right(pNumber, 3)
        If Val(xValue) <> 0 Then
            xValue = Right("000" & xValue, 3)
            If Mid(xValue, 1, 1) <> "0" Then
                xHundred = GetDigit(Mid(xValue, 1, 1)) & " Hundred "
            End If
            If Mid(xValue, 2, 1) <> "0" Then
                xHundred = xHundred & GetTens(Mid(xValue, 2))
            Else
                xHundred = xHundred & GetDigit(Mid(xValue, 3))
            End If
        End If
        If xHundred <> "" Then
            Dollars = xHundred & arr(xIndex) & Dollars
        End If
        If Len(pNumber) > 3 Then
            pNumber = Left(pNumber, Len(pNumber) - 3)
        Else
            pNumber = ""
        End If
        xIndex = xIndex + 1
    Loop
    Select Case Dollars
        Case ""
            Dollars = "No Dollars"
        Case "One"
            Dollars = "One Dollar"
        Case Else
            Dollars = Dollars & " Dollars"
    End Select
    Select Case Cents
        Case ""
            Cents = " and No Cents"
        Case "One"
            Cents = " and One Cent"
        Case Else
            Cents = " and " & Cents & " Cents"
    End Select
    SpellNumberToEnglish = Dollars & Cents
    End Function
    Function GetTens(pTens)
    Dim Result As String
    Result = ""
    If Val(Left(pTens, 1)) = 1 Then
        Select Case Val(pTens)
            Case 10: Result = "Ten"
            Case 11: Result = "Eleven"
            Case 12: Result = "Twelve"
            Case 13: Result = "Thirteen"
            Case 14: Result = "Fourteen"
            Case 15: Result = "Fifteen"
            Case 16: Result = "Sixteen"
            Case 17: Result = "Seventeen"
            Case 18: Result = "Eighteen"
            Case 19: Result = "Nineteen"
            Case Else
        End Select
    Else
    Select Case Val(Left(pTens, 1))
        Case 2: Result = "Twenty "
        Case 3: Result = "Thirty "
        Case 4: Result = "Forty "
        Case 5: Result = "Fifty "
        Case 6: Result = "Sixty "
        Case 7: Result = "Seventy "
        Case 8: Result = "Eighty "
        Case 9: Result = "Ninety "
        Case Else
    End Select
    Result = Result & GetDigit(Right(pTens, 1))
    End If
    GetTens = Result
    End Function
    Function GetDigit(pDigit)
    Select Case Val(pDigit)
        Case 1: GetDigit = "One"
        Case 2: GetDigit = "Two"
        Case 3: GetDigit = "Three"
        Case 4: GetDigit = "Four"
        Case 5: GetDigit = "Five"
        Case 6: GetDigit = "Six"
        Case 7: GetDigit = "Seven"
        Case 8: GetDigit = "Eight"
        Case 9: GetDigit = "Nine"
        Case Else: GetDigit = ""
    End Select
    End Function
    A screenshot showing the code editor
  4. 按 “Alt” + “Q” 返回工作表。

步驟 2:應用該函數

  1. 在單元格中,輸入以下公式並按 “Enter” 鍵。
    =SpellNumberToEnglish(A2)
  2. 然後拖動填充柄以應用於其他行。您的數字現在將被拼寫成文字,例如:
    A screenshot showing the user-defined function and the results

適應其他貨幣:

該函數輸出的值是以 “Dollar(s)” 和 “Cent(s)” 表示,這些都是硬編碼的,只適用於美元。如果您想將數字轉換為其他貨幣,例如 “英鎊”,則需要手動更改以下代碼行中的主要和次要單位。

A screenshot showing how to change the codes to adapt for other currencies

將工作簿保存為啟用宏的文件

默認情況下,除非將工作簿保存為啟用宏的工作簿,否則 VBA 函數不會保留:

  1. 按 “Ctrl” + “S” 保存。
  2. 並在彈出的關於宏的消息中選擇 “返回” 按鈕。
    注意:如果彈出窗口僅顯示 “是”、“否” 和 “幫助”,請點擊 “否”。
    A screenshot showing how to change the codes to adapt for other currencies
  3. 在 “另存為” 窗口中。
    1. 選擇保存位置。
    2. 在 “保存類型” 下拉列表中選擇 “Excel 啟用宏的工作簿 (*.xlsm)”。
    3. 點擊 “保存”。
      A screenshot showing how to change the codes to adapt for other currencies

SpellNumberToEnglish VBA 函數的限制

不支持多種語言
  • 此函數僅生成英文結果。
  • 它不支持其他語言(例如法語、德語),也不處理貨幣單位在數字前的貨幣結構(例如印度英語中的“盧比一百”)。
未保存在標準 Excel 文件中
  • 如果未將工作簿保存為啟用宏的工作簿 (.xlsm),關閉 Excel 時該函數將丟失。
  • 如果保存為普通的 .xlsx 文件,所有 VBA 程式碼將被刪除。
共享時會出現宏安全警告
  • 將啟用宏的文件發送給他人時,打開時會觸發“安全警告 – 已禁用宏”的提示。
  • 一些用戶可能會猶豫是否啟用宏,擔心潛在的安全風險,並可能選擇不使用該文件。
需要 VBA 知識進行自定義
  • 任何對貨幣術語或格式的更改都需要手動編輯 VBA 程式碼。
  • 對於不熟悉宏或腳本的用戶來說並不理想。

方法 3:使用 Kutools for Excel(無需公式或 VBA)

如果安裝了 “Kutools for Excel”,可以使用其 “Numbers to Words” 功能將數字轉換為英文(貨幣或純文本)、數十種其他語言和貨幣,例如歐元、英鎊、日元等。

如果您正在尋找一種無需編碼、用戶友好且多功能的解決方案來在 Excel 中將數字轉換為文字,Kutools for Excel 提供了一個專門的“Numbers to Words”功能,支持:

  • 英文(美元、英鎊、歐元等)
  • 數十種其他語言和貨幣(例如日元、印度盧比、人民幣)
  • 貨幣格式或純文字(例如,“一百二十三”而不是“一百二十三美元”)

使用步驟:

  1. 選擇包含要轉換數字的單元格。
  2. 選擇 “Kutools” > “內容” > “Numbers to Words”。
  3. 在 “Numbers to Currency Word” 對話框中,您需要:
    1. 選擇您偏好的語言和貨幣樣式(例如,英文 – 美國用於美元)
    2. 點擊 “確定”。
      A screenshot showing the numbers to currency word dialog box

可選:勾選 “Not converted to currency” 如果您想要純英文單詞(沒有 “美元” 或 “美分”)。

根據您的設置,所選數字現在將被轉換為相應的貨幣單詞。

Kutools for Excel - 超過 300 種必備工具,讓 Excel 功能更強大。永久免費享受 AI 功能!立即獲取


反向操作:將貨幣文字轉換為數字

如果您有一系列以英文單詞書寫的貨幣金額,例如:

“一百二十三美元四十五美分”

並且您想將它們轉換為實際數字在 Excel 中(例如,123.45),您可以按照以下方式使用自定義 VBA 使用者自訂函數 (UDF)。

步驟 1:打開 VBA 編輯器並插入 VBA 程式碼

  1. 打開您的 Excel 工作簿。
  2. 按 “Alt” + “F11” 打開 “Microsoft Visual Basic for Applications (VBA)” 編輯器。
  3. 在 VBA 編輯器中,點擊 “插入” > “模塊”。
  4. 複製並粘貼以下 VBA 程式碼到空白模塊窗口中:
    Function WordsToNumber(ByVal Txt As String) As Double
    'Updated by Extendoffice
        Dim x As Object: Set x = CreateObject("Scripting.Dictionary")
        Dim units, tens, specials
        Dim part As String, parts() As String
        Dim total As Double, partial As Double, multiplier As Double
        Dim i As Long, word As String
        
        Txt = LCase(Trim(Txt))
        Txt = Replace(Txt, ",", "")
        Txt = Replace(Txt, "-", " ")
        Txt = Replace(Txt, " and ", " ")
        Txt = Replace(Txt, "  ", " ")
        
        ' Setup basic number words
        x.Add "zero", 0: x.Add "one", 1: x.Add "two", 2: x.Add "three", 3
        x.Add "four", 4: x.Add "five", 5: x.Add "six", 6: x.Add "seven", 7
        x.Add "eight", 8: x.Add "nine", 9: x.Add "ten", 10: x.Add "eleven", 11
        x.Add "twelve", 12: x.Add "thirteen", 13: x.Add "fourteen", 14
        x.Add "fifteen", 15: x.Add "sixteen", 16: x.Add "seventeen", 17
        x.Add "eighteen", 18: x.Add "nineteen", 19: x.Add "twenty", 20
        x.Add "thirty", 30: x.Add "forty", 40: x.Add "fifty", 50
        x.Add "sixty", 60: x.Add "seventy", 70: x.Add "eighty", 80
        x.Add "ninety", 90: x.Add "hundred", 100: x.Add "thousand", 1000
        x.Add "million", 1000000: x.Add "billion", 1000000000
        
        Dim dollarPart As String, centPart As String
        Dim dollarValue As Double, centValue As Double
        
        ' Split into dollars and cents
        If InStr(Txt, "dollar") > 0 Then
            dollarPart = Trim(Split(Txt, "dollar")(0))
        End If
        If InStr(Txt, "cent") > 0 Then
            centPart = Trim(Split(Txt, "cent")(0))
            If InStr(centPart, "dollar") > 0 Then
                centPart = Trim(Split(centPart, "dollar")(1))
            End If
        End If
        
        dollarValue = ParseWordsToNumber(dollarPart, x)
        centValue = ParseWordsToNumber(centPart, x)
        
        WordsToNumber = dollarValue + centValue / 100
    End Function
    
    Private Function ParseWordsToNumber(ByVal Txt As String, x As Object) As Double
        Dim parts() As String: parts = Split(Txt, " ")
        Dim total As Double, current As Double
        Dim i As Long, val As Double
        
        For i = 0 To UBound(parts)
            If x.exists(parts(i)) Then
                val = x(parts(i))
                Select Case val
                    Case 100
                        If current = 0 Then current = 1
                        current = current * val
                    Case Is >= 1000
                        If current = 0 Then current = 1
                        total = total + current * val
                        current = 0
                    Case Else
                        current = current + val
                End Select
            End If
        Next i
        
        total = total + current
        ParseWordsToNumber = total
    End Function

步驟 2:在您的表格中應用該函數

  1. 按 “Alt” + “Q” 返回 Excel。
  2. 在任何空單元格中,輸入此公式並按 “Enter” 鍵。將 “填滿控制點” 向下拖動以獲取其餘結果。
    =WordsToNumber(A2)
    A screenshot showing how to convert words to numbers

結論

將數字轉換為文字——或文字轉回數字——不是 Excel 原生提供的功能,但本指南表明根據您的需求有多種實用的解決方案:

  • Microsoft 365 用戶可以利用現代內建函數如 TRANSLATE 將貨幣數字轉換為英文單詞,特別是對於遵循“主單位+輔單位”結構的貨幣。
  • VBA 使用者自訂函數在將數字轉換為文字以及將貨幣文字轉換回數值方面提供了更大的靈活性。然而,它們附帶與宏相關的安全問題,最適合熟悉編程的用戶。
  • Kutools for Excel 提供了最簡單、最多語言支持且功能豐富的選項——無需公式或編程,涵蓋數十種貨幣和語言。
  • 如果需要將文字轉換回數字,VBA 解決方案能有效地填補這一空白,儘管可能需要清理(例如刪除逗號)以獲得準確的結果。

無論您是在準備財務文件、自動化支票打印還是增強數據展示,選擇正確的方法有助於您實現專業且準確的輸出。


最佳 Office 辦公效率工具

🤖 Kutools AI Aide:徹底革新數據分析,基於智能執行|生成程式碼|創建自訂公式|分析數據並生成圖表|調用 Kutools Functions
熱門功能查找、選取項目的背景色或標記重複值 | 刪除空行 | 合併列或單元格且不丟失資料 | 四捨五入...
高級 LOOKUP多條件查找|多值查找|多表查找|模糊查找...
高級下拉列表快速創建下拉列表 | 關聯下拉列表 | 多選下拉列表 ...
列管理器添加指定數量的列 | 移動列 | 切換隱藏列的可見狀態 | 區域與列比較 ...
精選功能網格聚焦 | 設計檢視 | 增強編輯欄 | 工作簿及工作表管理器 | 資源庫 (自動文本) | 日期提取器 | 合併資料 | 加密/解密儲存格 | 按清單發送電子郵件 | 超級篩選 | 特殊篩選(篩選粗體/傾斜/刪除線 ...)...
前15 大工具集12 款文本工具添加文本刪除特定字符,...)|50+ 種圖表 類型甘特圖,...)|40+ 實用 公式基於生日計算年齡,...)|19 款插入工具插入QR码按路徑插入圖片,...)|12 款轉換工具金額轉大寫匯率轉換,...)|7 款合併和分割工具高級合併行分割儲存格,...)| ...以及更多
使用 Kutools 支援你的語言——支援英語、西班牙語、德語、法語、中文及40 多種語言!

利用 Kutools for Excel 大幅提升你的 Excel 技能,感受前所未有的高效體驗。 Kutools for Excel 提供超過300 項高級功能,助你提升效率並保存時間。 點此查看你最需要的功能...


Office Tab 為 Office 帶來標籤式介面,讓你的工作更加輕鬆

  • 啟用 Word、Excel、PowerPoint 的標籤式編輯和閱讀功能
  • 在同一個視窗的標籤中打開和創建多個文件,而不是在新窗口中分開開啟。
  • 可提升你50% 的工作效率,每天為你大量減少滑鼠點擊次數!