Help with c# utility class

Hi,

I have to write a uitlity class using c# for a application using this condtion

if my table a has

itemid userid productid itemtype

1 1 274 laptop

2 1 274 computer

then my class shud return no of copies of product as 1 because one product can be accessed by laptop/computer per user.

if the same table has this condition

itemid userid productid itemtype
1 1 274 laptop

2 1 274 desktop

3 2 274 desktop

4 2 274 desktop

we need three copies of product as user 1 has both laptop and desktop where as 2 two desktop

itemid userid productid itemtype
1 1 274 laptop

2 2 274 desktop

2 2 274 desktop

we need only two copies of product as we have duplicates for user 2.

using these conditions can u help me define a utility class where we need to find minimum no of copies required for product for a product id 274 using

a excel sheet.