Count rows from specific column and specific values in datatable

hey,

I need help counting the number of rows with a specific value from a specific column in datatable
for example
image

i need to count how many ‘None’ Value i have in column ‘Item’

You can try this query to get the count

dt.Select(“[Item]=‘None’”).CopyToDataTable.Rows.Count

or this if you want to perform string operations

dt.AsEnumerable().Where(Function(s) s(“Item”).ToString.Trim.Equals(“None”,StringComparison.OrdinalIgnoreCase)).CopyToDataTable.Rows.Count.ToString

Thanks
John

2 Likes

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