New Tool Radar

AI for Data & Spreadsheets

How to Change a Column Type with Power Query in Excel

Change a column to the correct type in Power Query so numbers add up and dates sort the way they should.

Schematic illustration for How to Change a Column Type with Power Query in Excel: three numbered steps - From Table/Range; Change Type to number; Fix any errors.

A column of numbers stored as text will not add into a SUM, and a column of dates stored as text will not sort chronologically. Changing the type in Power Query fixes the whole column at once, and any value that cannot convert shows as an error to be fixed, not silently dropped.

Prerequisites

  • Excel with Power Query
  • A table with a wrongly typed column
  • A copy of the source file, so the original stays untouched.

Steps

  1. Select the table and go to Data, From Table/Range to open it in the Power Query Editor.
  2. Select the column, then go to Transform, Data Type, and pick the right type, such as Decimal Number or Date.
  3. Check the rows that show errors after the type change, and fix those values in the source file.
  4. Confirm the column values now right-align for numbers and sort correctly for dates.
  5. Click Close and Load, then add a SUM or sort the column to prove the type is right.

Worked example: Fictional sales amounts changed to numbers

The practice table below is a fictional five-sale list after the type change. Each amount is a sale value, and the total is their sum. The table below is fictional practice material, with fictional values. It is the expected result, worked out by hand, not a run of any tool.

Sale Amount
Sale 1 24.00
Sale 2 18.50
Sale 3 32.75
Sale 4 15.25
Sale 5 41.00
Total 131.50

Expected result. Five amounts converted to numbers, and the amounts add to 131.50.

Limits

  • Changing the type does not fix the source data, so a value that fails to convert must be fixed in the source.
  • A column that mixes numbers and text will produce errors on the text rows, which must be handled, not ignored.

Sources

See all