Google Sheets’ TO_PURENUMBER function solves a common pain point: when your data contains text that looks like a number (e.g., "$50.00", "123K", or "Price: 42"), you can’t perform calculations or sort it correctly. Yes, it exists—but only in Google Sheets’ newer formulas, and it requires a slight workaround to work reliably in older versions. Here’s how to use it properly, plus where it fails and how to debug it.
What You’ll Need
- A Google Sheet (or Sheets on Android/iOS) with numbers embedded in text.
- Access to Google Sheets’ formula editor (not the basic cell entry).
- Knowledge of how the numbers are formatted in your data (e.g., currency symbols, letters).
Step-by-Step
- Identify the problematic cells:
Open your sheet and highlight the cells containing numbers in text (e.g., A2:A10). Note their exact format—does it include symbols like $, %, or letters like K? For example:
A2might contain "123K" whileB2has "$75.99". - Use a helper column for cleaning (this is the workaround for older Sheets versions):
In an empty column to the right (e.g., B2), enter a formula that extracts the numeric part. For numbers with letters like "K":
=VALUE(MID(A2, FIND("0", A2), LEN(A2)))For currency symbols, use:=VALUE(RIGHT(SUBSTITUTE(A2, "$", ""), LEN(A2)-FIND("$", A2)))Test this in a few cells. If it works, proceed to the next step. - Replace the text with pure numbers: Select the helper column and copy the results. Paste it into the original column (hold Ctrl/Cmd + Shift + V for "Paste Values Only"). This converts "123K" to 123, "$75.99" to 75.99.
- Use the real TO_PURENUMBER (in newer Sheets versions):
In the now-clean numeric column, enter:
=TO_PURENUMBER(A2)whereA2is the cell with the pure number. This formula will work on any cell that Sheets recognizes as a number (e.g., 42, -15, or 3.14). For mixed formats (e.g., "50%" as a string), add error handling:=IFERROR(TO_PURENUMBER(A2), "Not a number")
Common Mistakes
- Ignoring non-numeric prefixes: If your data has letters like "K" or "M", the formula fails. Always test with
MID/FINDfirst. Example: "50K" →VALUE(MID("50K", FIND("0", "50K"), LEN("50K")))= 50. - Overwriting helper column changes: If you paste values without "Paste Values Only," the original text remains. Always use
Ctrl/Cmd + Shift + V. - Using TO_PURENUMBER on mixed data: For cells like "10%," Sheets may return an error or 0.25 if misformatted. Add error checks (see step 4).
- Skipping validation: After converting, verify the results with a quick SUM or AVERAGE. A discrepancy means your text still contains unintended symbols.
Tips
- Batch-process with REGEX or TEXTSPLIT: For thousands of cells, use
=TEXTSPLIT(A2, " ")to split text, then filter numeric parts. Alternatively, Google Apps Script can automate this for large datasets. - Test with edge cases: Try "1.23e4," "42,000," or "0.99%." The formula should handle scientific notation and commas (use
REPLACEto strip them). - Use FILTER for conditional cleaning: If some cells are "valid" (e.g., "42") and others are "invalid" (e.g., "30%"):
=FILTER(A2:A10, REGEXMATCH(A2:A10, "^[0-9]+(.[0-9]+)?$")) - Check for hidden characters: Press
Ctrl/Cmd + Hto find/replace hidden symbols (like non-breaking spaces) before converting.
Troubleshooting
- Error: "Not a number":
- Revert to the helper-column method (steps 1–3) to isolate the issue. Some cells may have characters like # or & that interfere with
VALUE. - Use
ISNUMBERto check if a cell is a pure number:=ISNUMBER(A2).
- Revert to the helper-column method (steps 1–3) to isolate the issue. Some cells may have characters like # or & that interfere with
- Formula returns #VALUE!:
The data might contain letters or symbols not covered by
TO_PURENUMBER. Add a filter for numeric-only matches or useIFERROR(step 4) - Data doesn’t update: Sheets caches formulas. Click outside the cell, then back to see changes. For large sheets, try reordering columns.
- Performance lag:
Converting 10,000+ cells can slow Sheets. Use Google Apps Script for automation:
function cleanNumbers() { const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); const data = sheet.getDataRange().getValues(); const cleaned = data.map(row => row.map(cell => TO_PURENUMBER(cell))); sheet.getRange(2, 1, data.length, 1).setValues(cleaned); }(Note: This only works in Apps Script, not the formula editor.)
Frequently Asked Questions
Will TO_PURENUMBER work on Excel?
No. Google Sheets’ TO_PURENUMBER is a unique function—Excel uses REGEXEXTRACT or CLEAN instead. For Excel, try: =REGEXEXTRACT(A2, "\d+\.?\d*") to extract numbers from text.
How do I handle scientific notation (e.g., "5e3")?
Use a combination of VALUE and REPLACE:
=VALUE(REPLACE(A2, "e", "E"))
(This converts "5e3" to 5000. For more complex cases, use a helper column with regex.)
Why does my data look correct but formulas fail?
Hidden formatting may be present. Check for these:
- Hidden characters (Ctrl/Cmd + H > Replace > " " → nothing).
- Currency symbols like € or ¥ (use
REGEXREPLACEto remove them). - Percent signs (%) or commas (use
REPLACEto strip them).
Can I use TO_PURENUMBER on formulas like "=A2+B2"?
No. TO_PURENUMBER only works on cells containing values—it doesn’t modify formulas themselves. Clean the cells first (step 3), then use them in formulas.
How do I convert "1,000" (with commas) to a pure number?
Use VALUE with REPLACE:
=VALUE(REPLACE(A2, ",", ""))
For regional formatting (e.g., "1.000"), add decimal handling:
=VALUE(REPLACE(REPLACE(A2, ",", ""), ".", "")
Is there a way to auto-format text numbers before running TO_PURENUMBER?
Yes, use TEXT:
=TEXT(A2, "0") truncates text to numbers. For advanced use, combine with REGEXEXTRACT to extract numbers only:
=REGEXEXTRACT(A2, "\d+")