Function to return interger with greatest value
Author Message
Function to return interger with greatest value

I need to create a pareto chart showing the values of multiple fields in
decending order.  How do I sort a table fields based on the values in the
record.  The query to create the single record is no problem.  Is there a
function that will return the integer with the greatest value in an array?

Don

Wed, 13 Jun 2001 03:00:00 GMT
Function to return interger with greatest value
There isn't a built-in function for returning the max value in an
array. The following should work for any array of doubles:

Public Function MaxValue(adblArray() As Double) As Double
Dim intI As Integer
Dim dblMax As Double
Next intI
MaxValue = dblMax
End Function

If you need to sort an array, there is good algorithm called
dhQuickSort in the VBA Developer's Handbook (Sybex), fully explained.
Or go to http://www.informant.com/mod/modfilearchive.asp and look for
MOD9803RS.zip for a version by Rod Stephens.

-- Andy

Quote:

>I need to create a pareto chart showing the values of multiple fields in
>decending order.  How do I sort a table fields based on the values in the
>record.  The query to create the single record is no problem.  Is there a
>function that will return the integer with the greatest value in an array?

>Don

Thu, 14 Jun 2001 03:00:00 GMT
Function to return interger with greatest value
Andy,

Thanks, I'll check that our.  It seems like it would work

Don

Quote:
>There isn't a built-in function for returning the max value in an
>array. The following should work for any array of doubles:

>Public Function MaxValue(adblArray() As Double) As Double
>  Dim intI As Integer
>  Dim dblMax As Double
>  Next intI
>  MaxValue = dblMax
>End Function

>If you need to sort an array, there is good algorithm called
>dhQuickSort in the VBA Developer's Handbook (Sybex), fully explained.
>Or go to http://www.informant.com/mod/modfilearchive.asp and look for
>MOD9803RS.zip for a version by Rod Stephens.

> -- Andy

>>I need to create a pareto chart showing the values of multiple fields in
>>decending order.  How do I sort a table fields based on the values in the
>>record.  The query to create the single record is no problem.  Is there a
>>function that will return the integer with the greatest value in an array?

>>Don

Thu, 14 Jun 2001 03:00:00 GMT
Function to return interger with greatest value
Don --
I assume that your records consist of some sort of ID (date, machine,
group, whatever) and then a tally of the incidence of a list of problems.
You might want to consider creating a new table each of which contains the
ID, a problem label or code, and a tally.  Then you can just sum and sort
this table.  The advantage of this organization is that it can handle
changed problem lists more easily.
-- Roger
Quote:

>I need to create a pareto chart showing the values of multiple fields in
>decending order.

Fri, 15 Jun 2001 03:00:00 GMT

 Page 1 of 1 [ 4 post ]

Relevant Pages