Get a datatable cell value based on max value of other column

|Labour | Machine | PCValue | |
|500 | 54 | Pajhds7 | |
|400 | 345 | Puyr89 | |
|200 | 4353 | Pfds0932 | |

need to get PCValue where Labour Value is Max

Might be worth ordering by Labour, then selecting 1st row, column PCValue for example:

dt.AsEnumerable.OrderByDescending(Function(x) CDbl(x("Labour"))).Select(Function(y) y("PCValue").ToString).First

Edit: Adding screenshot + fixing a missing “)”


image

Hi @jain.priti26

Try the below LINQ Expression,

- Assign -> PCValue =  (From row In dataTable.AsEnumerable()
                        Order By Convert.ToInt32(row("Labour")) Descending
                        Select row("PC Value")).FirstOrDefault()

PCValue is a variable which stores the output value.

Hope it helps!!