The BAHTTEXT function in Google Sheets allows you to convert a given number into Thai language text, where “th” is the language code for the output.
I used the DETECTLANGUAGE function to identify the code for translating the text. However, users familiar with the Thai language can easily read the output of the BAHTTEXT function in Google Sheets without additional translation.
Since I’m not familiar with the Thai language, I used the GOOGLETRANSLATE function in Google Sheets to translate the output into English. Through this, I discovered that the formula appends the currency “Baht” for integers and “Satang” for decimals. However, I encountered some translation issues, which I will address later.
First, let’s explore how to use the BAHTTEXT function in Google Sheets.
BAHTTEXT Function in Google Sheets – Syntax, Arguments, and Examples
Syntax:
BAHTTEXT(number)
Arguments:
- number: The number to convert. It can be a numeric value, a cell reference, an array, or an array reference.
Formula Examples
The following examples demonstrate the usage of the BAHTTEXT function in Google Sheets for different types of inputs:
Number:
=BAHTTEXT(100) // returns หนึ่งร้อยบาทถ้วน
Cell Reference:
=BAHTTEXT(A1)
Array:
To use the BAHTTEXT function with arrays, include the ArrayFormula function. Ensure that enough blank cells are available below the formula cell to display the results.
=ArrayFormula(BAHTTEXT({1;2;3;4;5;6;7;8;9;10}))
This formula converts the numbers 1 to 10 into Thai language text.
Array Reference:
Suppose you need to convert the numbers in the range B2:B11 into Thai text. You can use the following formula in cell C2 after clearing any existing content in the range C2:C11:
=ArrayFormula(BAHTTEXT(B2:B11))
Key Features
Here are some of the key features of the BAHTTEXT function in Google Sheets:
- It converts both integer and decimal values.
- It can handle negative values. To exclude the negative sign, wrap the number with the ABS function (e.g.,
=BAHTTEXT(ABS(B2))
). - A blank cell evaluates to 0 (zero) and is converted accordingly.
- If the number argument is text, the result will be a
#VALUE!
error. - Numbers formatted as text are converted without issue.
- If the number argument contains an error value, the formula returns the same error.
Using BAHTTEXT with GOOGLETRANSLATE in Google Sheets
When I first explored this function, I considered combining it with the GOOGLETRANSLATE function to convert numbers into English text. While it works, the output isn’t always accurate. Here’s how you can try it:
Steps:
- Enter some numbers in the range B2:B18, as shown in the screenshot below.
- To convert the numbers into Thai text, use the following formula in cell C2 and drag it down:
=BAHTTEXT(B2)
Alternatively, use:=ArrayFormula(BAHTTEXT(B2:B18))
Ensure that the range C2:C18 is empty before inserting the formula. - To translate the Thai text into English, use the following formula in cell D2 and drag it down:
=GOOGLETRANSLATE(C2,"th","en")
Here, “th” and “en” represent the language codes for Thai and English, respectively.
When combining BAHTTEXT with GOOGLETRANSLATE, I noticed inconsistencies in the translation. For instance, the amount 1110 initially translated from Thai text to English as “One thousand one hundred million.” However, the updated translation now correctly displays “One thousand one hundred and ten baht.”
Had the translations been consistently accurate, I planned to use REGEXREPLACE or SUBSTITUTE to replace “Baht” and “Satang” with “Dollars” and “Cents,” respectively. Given the initial inconsistencies, I decided against it.
Note: Recent observations suggest that developers may have improved the function’s accuracy. For example, 1110 now returns the Thai text “หนึ่งพันหนึ่งร้อยสิบบาทถ้วน
” and translates accurately to “One thousand one hundred and ten baht.” This behavior was different earlier (please see the image above).
Conclusion
That’s how you can use the BAHTTEXT function in Google Sheets to convert numbers into Thai language text. While it’s a powerful feature, its integration with other functions like GOOGLETRANSLATE requires careful handling due to potential inconsistencies.
Thanks for reading. Enjoy!
Resources
- Amount or Numbers to Words Converter Using Google Sheets
- Convert Currency-Formatted Text to Numbers in Google Sheets
- Concatenate a Number Without Losing Its Format in Google Sheets
- How to Format Numbers as Fractions in Google Sheets
- Format Numbers as Currency Using Formulas in Google Sheets
- Format Numbers To Millions and Thousands in Google Sheets
- Currency Conversion in Google Sheets Using GOOGLEFINANCE
- Extract Numbers Prefixed by Currency Signs from a String in Google Sheets
- Currency Formatting in Google Sheets Drop-Downs