Delete row?

I​ want to​ count character column create id if​ count = 7​ insert 0​ in​ front of​ old text.
If​ cound <=6 delete row.

Please guide me for solve it.
Thank you
data.xlsx (10.2 KB)

Hi @fairymemay

=> Read Range Workbook. Please Enable Preserve Format Option.


Output-> dt

=> Use below syntax in Assign:

filteredRows = (From row In dt.AsEnumerable()
Let CreateID = If(row.Field(Of String)(2).Length <= 6, "0" + row.Field(Of String)(2), row.Field(Of String)(2))
Let newCreateID = CreateID
Where Not newCreateID.Length = 7
Order By DateTime.ParseExact(row.Field(Of String)(4), "M/d/yyyy HH:mm", System.Globalization.CultureInfo.InvariantCulture)
Select dt.Clone().Rows.Add({row.Field(Of String)(0), row.Field(Of String)(1), newCreateID, row.Field(Of String)(3), row.Field(Of String)(4), row.Field(Of String)(5)})).CopyToDataTable()

filteredRows is of DataType System.Data.DataTable

=> Write Range Workbook filteredRows.
image

Regards

1 Like

image
This is input file
and Below is the output
image

Count_Cha1r.zip (46.9 KB)

1 Like

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