You can use this function to return the Max Value, Like wise you can update
the function to return Min Value.

Function to Return Max Value in an Array
Public Function getArrMaxValueIndex(ByVal arr)
        Dim ix, ixMax
        ixMax = 0
        For ix = 1 To UBound(arr)
            If ( arr(ixMax) < arr(ix) ) Then
                ixMax = ix
            End If
        Next
        getArrMaxValueIndex = ixMax
End Function

'Define array and index for max entry
Dim arr, ixMax

'Initialize the array
arr = Array(4, 1, 3, 6, 7, 23,567,34,44)

'Get the index of the max value
ixMax = getArrMaxValueIndex(arr)

'Print result
MsgBox "Max value: " & arr(ixMax) & " was found at " & ixMax & " index."


Cheers,

Anoj Atapattu



On Mon, Jan 24, 2011 at 12:40 PM, ashok n <[email protected]> wrote:

> u have to go for any sorting  orders then u can find out..
>
> if you are not clear let me know..
>
> i will update u the logic..
>
> Regards
>
> Ashok.N
> CapGemini India Pvt Ltd
>
> On Mon, Jan 24, 2011 at 12:18 PM, shalini reddy 
> <[email protected]>wrote:
>
>> i have an array values as a(2,6,4,7)
>> how can i find the max and min values ,,,,
>>
>>
>> Regards
>> Shalini
>>
>> --
>> You received this message because you are subscribed to the Google
>> "QTP - HP Quick Test Professional - Automated Software Testing"
>> group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]<mercuryqtp%[email protected]>
>> For more options, visit this group at
>> http://groups.google.com/group/MercuryQTP?hl=en
>
>
>
>
> --
> Cheers,
>
> Ashok Kumar.N
> +91 9711545679
>
>  --
> You received this message because you are subscribed to the Google
> "QTP - HP Quick Test Professional - Automated Software Testing"
> group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<mercuryqtp%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/MercuryQTP?hl=en
>

-- 
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en

Reply via email to