How count present date count based on find least count date present cell value

Hi Team,

I have one excel , In the data table i want find name column based count today date for each person and find who is least count today date.

Input excel:

Expected output:
XXX = 2
YYY = 1
ZZZ = 4

Result : Least count is person: YYY

if suppose same count come in two person or three person will choose random one person.

Please help me anyone for this

Regards,
Raja G

Hi @Raja.G ,

Could you Check with the below Expression :

DT.AsEnumerable.OrderBy(Function(x)x.ItemArray.Skip(2).Where(Function(y)y.ToString.Contains(Now.ToString("MM.dd.yy"))).Count).First.Item("Name").ToString

Here, DT is your Datatable variable.

Let us know if it doesn’t work and what was the error received.

1 Like

Hi @supermanPunch ,

Worked fine but If suppose same count of 2 person i want to get one random person , that one also i need please help me for this.

Regards,
Raja G

@Raja.G ,

Check the Expression with different data and let us know what are your observations. And when random is mentioned, it is randomly selecting one value. When followed the approach mentioned above it could also be one of the random values but it will select the First of the same count persons (could also be called as random).

Could you let us know why the importance is laid on the term random here ?

Hi @supermanPunch ,

Yes working fine, Thanks

Random is both same count i want to take any one person so only

Regards,
Raja G

1 Like

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