Table Transform add zero

mduntley

Board Regular
Joined
May 23, 2015
Messages
139
Office Version
  1. 365
Platform
  1. Windows
So I found a way yesterday to use table.Transform to add a leading zero if its not 4 digits, but I forgot how I did it

Power Query:
= #table({"Column 1"}, {{"740"},{"250"},{"0943"},{"420"},{"430"},{"440"},{"424"},{"0434"}})
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Power Query:
let
    Source = #table({"Column 1"}, {{""},{"0"},{"1"},{"21"},{"420"},{"430"},{"440"},{"1424"},{"0434"}}),
    tbl = Table.TransformColumns(Source, {"Column 1", each Text.PadStart(_,4, "0")})
in
    tbl
 
Upvote 0
Solution

Forum statistics

Threads
1,223,391
Messages
6,171,824
Members
452,426
Latest member
cmachael

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top