TO_TEXT function in Google Sheets
TO_TEXT converts a number into text. Its main job in Google Sheets is feeding numbers to functions that only accept text, such as REGEXMATCH and REGEXEXTRACT, and keeping codes like ZIP codes from being treated as amounts.
- Works in
- Google Sheets only
- Returns
- Text.
Syntax
=TO_TEXT(value)
| Argument | Required? | What it is |
|---|---|---|
value | Required | The number or cell to convert. Text passes through unchanged. |
Examples
Each result is calculated from the sample sheet by our formula engine in Sheets mode, the same one that grades the practice.
| Cell | Formula | Result | What it shows |
|---|---|---|---|
| B2 | =TO_TEXT(A2) | 90210 | The number as text: it no longer adds up in SUM |
| B3 | =REGEXMATCH(TO_TEXT(A3),"^1") | TRUE | REGEXMATCH needs text, so TO_TEXT goes inside it |
| B4 | =REGEXEXTRACT(TO_TEXT(A4),"^\d{3}") | 606 | The first three digits of the ZIP code |
Try it live
This is the sample sheet. Change any value or edit a formula, and the results update.
Practice TO_TEXT
Graded instantly in Sheets mode, then re-checked on changed data.
Pacific ZIP codes
C2, return TRUE when the ZIP code in B2 starts with 9 (the Pacific states). REGEXMATCH needs text, so convert the ZIP with TO_TEXT. Fill down to C7.Common mistakes
| What you see | Why, and how to fix it |
|---|---|
| SUM ignores the converted values | TO_TEXT returns text, and SUM skips text. Keep the original numbers for math, and convert only where a function needs text. |
| #VALUE! from REGEXMATCH on a column of numbers | Convert the whole range inside it: =ARRAYFORMULA(REGEXMATCH(TO_TEXT(A2:A10),"^9")). |
| Leading zeros are already gone | TO_TEXT can't bring back zeros that were never stored. A ZIP code like 02134 typed into a number cell is stored as 2134; format the column as plain text (Format > Number > Plain text) before typing. |
Tips
- A2&"" also turns a number into text, and works the same way in Excel.
- To choose how the number looks, such as with a currency sign, use TEXT with a format pattern instead.
TO_TEXT in Excel
Excel has no TO_TEXT, and its text functions accept numbers directly. Excel users convert with TEXT(A2,"0") or by joining an empty string: A2&"".
Questions
Why does REGEXMATCH say it expects text values?
The cell holds a number. Convert it with TO_TEXT: =REGEXMATCH(TO_TEXT(A2),"^9").
What is the difference between TO_TEXT and TEXT?
TEXT takes a format pattern, such as TEXT(A2,"$#,##0.00"), so you decide how the number looks. TO_TEXT has no pattern argument; it just turns the value into text.
Last reviewed October 2026. Every example result on this page is calculated live by the Spreadsheet Practice formula engine in Sheets mode.