To sort the numbers that have 4 digits

I have a column in Excel in which there are numbers of different formats and I need to sort the numbers that have 4 digits. How can this be implemented in StudioX?
image

Hi @teslyak9437

Try this

(From row In dt.AsEnumerable()
 Where row.Field(Of Double)("ColumnName").ToString().Length = 4 AndAlso IsNumeric(row.Field(Of Double)("ColumnName").ToString())
 Order By Convert.ToDouble(row.Field(Of Double)("ColumnName"))
 Select row).CopyToDataTable()

Input:

image

Output:

image

Regards,

It must to implemented in StudioX

@teslyak9437

Same as studio only

(From row In DT.AsEnumerable()
 Where row.Field(Of Double)("ColumnName").ToString().Length = 4 AndAlso IsNumeric(row.Field(Of Double)("ColumnName").ToString())
 Order By Convert.ToDouble(row.Field(Of Double)("ColumnName"))
 Select row).CopyToDataTable()

I must to delete this value

@teslyak9437 Can you clarify more about the input & output?

Must delete the value means?

Regards,
Ajay Mishra

@teslyak9437

How about the following?


Dim rowsToDelete = (From row In dt.AsEnumerable()
                    Where row.Field(Of Double)("ColumnName").ToString().Length = 4 AndAlso IsNumeric(row.Field(Of Double)("ColumnName").ToString())
                    Select row).ToList()


For Each rowToDelete In rowsToDelete
    dt.Rows.Remove(rowToDelete)
Next

Output:

image

Regards,

It must to implemented in StudioX

image

@teslyak9437

It is in studiox only please check

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