Convert text to dates and numbers
The Convert Column Type task changes a column's type: to Text, Number or Date, or to a meaning such as ID, Currency or Percentage. Open it from Column Management in the Transform menu, or from Convert Column Type in a column's 3-dot menu. It re-runs on every refresh, and a value that can't be converted (for example "John Doe" to Number or Date) becomes empty (null).
Convert one or more columns with Convert Column Type
- Click Describe your transformation (or a + in the Pipeline panel), choose Column Management, then Convert Column Type.
- In Select columns to convert, choose the source column. Each row handles one column.
- In Select new column type, choose the target. Number offers Number, ID, Percentage and Currency; Text offers Text and ID; Date is a single option. The current type is greyed out.
- Set the output format if the panel asks for one (see the table below).
- To convert another column in the same task, click + Convert more columns. The trash icon removes a row.
- Click Apply.
| Setting | When it appears | What it does |
|---|---|---|
| Values are on a 0–100 scale (the label goes on to say "divide by 100") | Converting a Number column whose largest value is above 1 to Percentage | Ticked by default. Divides every value by 100, so 45 becomes 0.45 (45%). Untick it to keep the values. Not shown for Text columns or for columns already between 0 and 1. |
| Format Output | Converting to Date, or from Date to Text | Convention: Universal, UK, US or Custom. Format string: a format from the list (for example YYYY/MM/DD, YYYY/MM/DD HH24:MI:SS, YYYY/MM/DD HH:MI:SS am, YYYY-MM-DD) or Custom to type your own. |
| Number format controls | Converting to Number | Set the number format of the result. |
| Define Source Format (gear icon next to the format string) | Converting Text to Date | Tells Mammoth what format the text is in now. See Convert text to a date. |
For example, an order_date column imported as Text holds values like "2025/01/15". Select it, choose Date, set the source format to Source - Auto, and set Format Output to YYYY/MM/DD. It is now a real Date for date filters and calculations.
Convert a column to ID, Currency or Percentage
Picking another entry under the column's own type (for example Currency for a Number column) changes only what the column means. It doesn't cast the values, except with the divide-by-100 option above. The panel sets the number format to match:
| Target | Format the panel sets for you |
|---|---|
| Currency | Never a percentage. The currency symbol stays yours to pick. |
| Percentage | Never a currency symbol. The % starts on and can be switched off. |
| ID (Number) | No currency symbol, no %, no thousands separator. Decimals start at 0 unless the column already had its own. |
Converting a code such as 000417 to ID under Text keeps the leading zeros; converting it to a Number drops them. See Column types, IDs, currency and percentages.
Check a conversion before you rely on it
- Test your format code on a few rows before you convert the whole column.
- Copy the column first with Copy Columns, so you can compare original and converted values.
- Try Source - Auto first for standard date formats (ISO, US, UK). Use format codes only if Auto fails, and never Auto for dates that could be day first or month first.
- After converting, spot-check the first rows, the last rows and any empty cells.
- Text-to-number assumes a comma thousand separator and a period decimal point. Clean other conventions first.
Related
- Convert text to a date with format codes: day and month order, codes, mixed formats.
- Convert text to numbers and Unix timestamps to dates: currency, separators, epoch values.
- Rename, format and sort columns: change how a date or number looks without converting it.
- Work with dates and financial years: calculate with dates once they are real dates.
Something wrong? support@mammoth.io