I’m using Delphi XE3 and I’m developing an application to read numerical type cells from Excel. I’m using TStringGrid for this import.
I already know, how to get them to the string grid, but can’t manage to do any mathmatical functions like in Excel. How do I calculate min, max and average values for selected cell values of my string grid ?
You can try the following function. It returns the count of numeric values found in the current string grid’s selection. To declared parameters passed to it returns minimum, maximum and average values from the current selection’s numeric values (if there are some):
Here’s a sample usage:
Another chapter is how to get notification when the selection of a string grid changes. There’s no event nor virtual method for implementing event like
OnSelectionChange. But that would be topic for another question.