hi,
i have an Excel Sheet columns → Name, city , Salary. in salary how to find second largest value in that column ?
can any one help about this .
1 Like
- First sort the data table(ascending order) on salary column by using sort data table activity
https://docs.uipath.com/activities/docs/sort-data-table - Then use the below expression to get the second highest salary
varDt.rows(varDt.rows.count-3)(2).ToString
Give a try on
YourDataTableVar.AsEnumerable.Select(Function (x) Convert.ToInt32(x("Salary"))).OrderByDescending(Function (i) i).ElementAt(1)
1 Like
thanks for reply .its working fine but the count is count -2 is correct . ->varDt.rows(varDt.rows.count-2)(2).ToString
You can adjust it after testing but logic will be same…If you are reading without header then 3 if you have considered headers then 2…
Just test with both and whichever is giving correct value go ahead with that
1 Like
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.