Forum Discussion
Svante109
7 years agoFrequent Visitor
IF then else function
My problem is - I've got two columns of serialnumbers. Most of them have 5 digits, but I have serialnumbers with 2,3, and 4 digits. In one column the serialnumber has leading zeros, while the other d...
RolandsP
7 years agoResolver IV
Please make sure that Data Type of the column is Text
- parry2k7 years agoSuper User
Svante109 seems like type of your uniserialno_ column is number, you need to check the length of the value in this column and then concatenate with number of zeros to make it proper length.
In following example, replace [Key] column with your column number and add more if condition to check length
(if Text.Length(Number.ToText([Key])) = 1 then "000" else if Text.Length(Number.ToText([Key])) = 2 then "00" else if Text.Length(Number.ToText([Key])) = 3 then "0" else "") & Number.ToText([Key])