Hello,
I have 1 excel file having a column name as ‘Found’ and it has “Yes” and “No” value in it, I need to count the number of “Yes” present in that column.
Thanks
Hello,
I have 1 excel file having a column name as ‘Found’ and it has “Yes” and “No” value in it, I need to count the number of “Yes” present in that column.
Thanks
Hey @Gagan_Chaudhari,
You can use filter datatable activity to filter by “Yes” and than you can use count method to count the number of rows.
dt.Rows.Count() this will return you the number of rows available in the datatable.
Thanks,
Sanjit Pal
hey
try this
yourDT.AsEnumerable.Where(function (x) x("Found").ToString.Trim.Equals("Yes")).CopyToDataTable.RowCount.ToString
Regards!
Hey @Gagan_Chaudhari,
you can try following Linq
dt.AsEnumerable.Count(Function(x) x("Found").ToString.ToLower.Trim.Equals("yes"))
Above Linq will Count the rows where Found column has the value as Yes in any case
ToLower - this is used just to handle edge cases, if in case the column contains different versions of YeS*
Thanks,
Saurabh
Hi @Gagan_Chaudhari we can achieve this using LINQ approach
Let’s say you have read that excel and stored in datatable DT
Now use an assign activity and let variable type be an integer
kindly use below linq query
(From r In DT Where (r("Found").toString.ToLower).equals ("yes") Select r).Count
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.