How do I count the number of times an item appears in a datatable?

Hi,

I have a list of items that I’ve extracted into a datatable:

image

My problem is I need to find the number of times a particular item in the list is displayed, say how many times ‘item 3’ is displayed in the list. How do I do this? I’m using C#.

Thanks

Hi @paulparkes ,

If you want to find Item 3 Occurence in DataTable,
Try filtering the Description Column with Item 3,
and assign a new variable itemCount=dtFilteredItems.RowCount.

That should give you the count.

regards,
Aditya

Perfect, thank you!

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