How to get only/read the last 6 digit in excel files

excel
activities

#1

Hi,

How to get / only read 6 digit numbers from one column in excel files?
I need use that 6 last digit number for compare that numbers with another data.
need advice for this.

Thank you very much and cheers :smile:

Delf


#2

Hi @delf,

Read the value and calculate the length of the string by using string.length

Check the length and add a condition.

Thanks,
Jiban


#3

Get the value from the column split it
StrValue=strValue.Substring(strValue.length-6)

Use the above code to get last 6 digits.

Regards,
Arivu


#4

@delf

If you want to read only 6 digit numbers from a column, use this

List A=(From row in dt.Select()
where row(“Column_Name”).ToString.Length=6
select Convert.ToString(row(Column_Name")).ToList()

Now list A will contain the numbers of length equal to 6

If you want the numbers whose length equal to or greater than 6 then use >=

Regards,
Mahesh