To Count if an Excel column has 14 digits or not

Hi Experts,

i want to Count Excel column has 14 digits or not and if not i need to add Zeros before the number. please can any one suggest how can i handle this situation.

Thanks,
Vikram

1 Like

Hey @vikram.g1 :wave:

You can get the no of digits using the below function:

Math.Ceiling(Math.Log10(yourIntVariable));

Try it and let me know if you are facing any issues.

Cheers!

1 Like

Hi @monsieurrahul ,

Can i get one example for the above if you donot mind, and also if the digit count is less than 14 i need to add zero’s at starting.
For Ex:
image

For Column 2,3 and 4 i need to add Zero’s.

Thanks.

1 Like

Try this workflow @vikram.g1

AddZeros.xaml (17.3 KB)

Cheers!

2 Likes

Hi ,
can you try this Linq Inside the Invoke Code .
InputDT.Select(“count(Id)<14”).ToList.ForEach(Sub(row) row(“Id”)=row(“Id”).toString.padleft(14,CChar(“0”)))

2 Likes

Hi, another way is Cint(row(“Id”).ToString).ToString(“D14”)

1 Like

String.padleft(14,”0”C)

1 Like

Hi @Priyanka_Ramesh,

Thanks for the replay, it worked for me.

Hi @tranthao240495

Thanks for the replay, issued is solved.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.