We can use the BAHTTEXT Function in Google Sheets to convert a given number to a Thai language text, and “Th” will be the language code of the output.
I have used the DETECTLANGUAGE function to find the code for translating the text.
It’s needless to say, users who know the Thai language can read the output of the BAHTTEXT formula in Google Sheets.
Since I am unfamiliar with this language, I have used the GOOGLETRANSLATE function in Sheets to translate the output into English.
I could find that the formula adds the currency “Baht” for integer and “Satang” for decimal and encountered a few issues in the translation. I’ll come to that later.
First of all, let’s learn how to use the BAHTTEXT text category function in Google Sheets.
BAHTTEXT Function in Google Sheets – Syntax, Arguments, and Examples
Syntax:
BAHTTEXT(number)
Arguments:
number
– It’s the number to convert and can be a number, cell reference, array, or array reference.
Formula Examples
The following examples of the BAHTTEXT Function in Google Sheets will help you better understand the ‘number’ argument usage.
Number:
=BAHTTEXT(100)
Cell Reference:
=BAHTTEXT(A1)
Array:
Here you must include the ArrayFormula function.
Further, please make sure sufficient blank cells (here 9) are available below the formula inserted cell to generate the result.
=ArrayFormula(bahttext({1;2;3;4;5;6;7;8;9;10}))
The above formula converts the numbers 1 to 10 into Thai language texts.
Array Reference:
Imagine, you have to convert the numbers in the range/array B2:B11 into Th, using the BAHTTEXT function in Google Sheets.
You can use the below formula for that in cell C2 after deleting existing formulas/values, if any, in C2:C11.
=ArrayFormula(BAHTTEXT(B2:B11))
Key Features
Here are some of the main features of the BAHTTEXT function in Google Sheets.
- It converts integer and decimal values.
- Convert negative values. To skip the negative sign, wrap the ‘number’ with the ABS function [E.g.
=BAHTTEXT(ABS(B2)
]. - It evaluates a blank cell to 0 (zero) and converts it accordingly.
- If the number argument is a text, the result would be #VALUE! error
- The formula has no issue in converting numbers that are formatted to text.
- An error value causes it to return the same error.
Using BAHTTEXT Function with GOOGLETRANSLATE in Google Sheets
When I first saw this function, I thought we could use it together with GOOGLETRANSLATE to convert numbers to English text.
It does convert, but I am not satisfied with the output. Do you know why?
Please follow the below steps to understand it.
Steps:
- Enter a few numbers as per the screenshot below in the range B2:B18.
- To convert the entered list of numbers into Thai text, insert
=BAHTTEXT(B2)
in cell C2 and drag it down. Alternatively we can use=ArrayFormula(BAHTTEXT(B2:B18))
in cell C2 after emptying C2:C18. - To translate the converted Thai text, we can use
=GOOGLETRANSLATE(C2,"th","en")
in cell D2 and drag it down. The “th” and “en” are the language codes for Thai and English, respectively.
See the highlighted texts. If all were perfect, I planned to use REGEXREPLACE or SUBSTITUTE to replace “Baht” and “Satan” with “Dollar” and “Cents,” respectively.
So I left the idea seeing the above output.
That’s all about how to use the BAHTTEXT Function in Google Sheets.
Thanks for the stay. Enjoy!
Resources: