How to find the highest value in a CSV file

Well @sharks14

You can try @sfranzen way as well but i have also one more way to do this :slight_smile:

No need to use for each for this :slight_smile:

You can get the highest column value for โ€œCloseโ€ Column like this

Int maxval = Convert.ToInt32(data.Compute("max([Close])",String.Empty))

one more way is Datatable.select() as @sfranzen mentioned.

there one more is to use IEnumerable.max method as well :wink:

String maxval = datatable.AsEnumerable().Max(Function(r) r("Close")).ToString

Feel free to use any one of them.

and if you wants to fetch the date as well from the max close amount row.

try this :
(Datatable.Select(โ€œ[Close]='โ€+ienumerable_Datarow.Max(Function(r) r(โ€œCloseโ€)).ToString+โ€œ'โ€))(0)(0).ToString

This is the first thing came into mind. @andrzej.kniola you can add more things i guess haha :slight_smile: :wink:

sample_shark.zip (3.0 KB)

Regardsโ€ฆ!!
Aksh

1 Like