Is there a way that I can determine the smallest i

# Thread: Is there a way that I can determine the smallest i

1. Senior Member
Join Date
Dec 1969
Posts
226

## Is there a way that I can determine the smallest i

Is there a way that I can determine the smallest integer among a group of number?<BR><BR>ie. A = 3, B = 2, C = 7<BR><BR>is there a script or build-in function that I will get the correct answer (B in this example) right away? Thanks.

2. Senior Member
Join Date
Dec 1969
Posts
155

## RE: Is there a way that I can determine the smalle

How about something like (of course if you have all your values greater then 10 you&#039;ll have to rewrite):<BR><BR>Function MinInt(a, b, c)<BR>Dim x <BR> x = 10<BR> If a &#060; x Then x = a<BR> If b &#060; x Then x = b<BR> If c &#060; x Then x = c<BR> MinInt = x<BR> Exit Function<BR>End Function

3. Senior Member
Join Date
Dec 1969
Posts
226

## How about if the numbers are dynamic?

nt

4. Senior Member
Join Date
Dec 1969
Posts
972

## RE: How about if the numbers are dynamic?

Do you mean: how about if the number of numbers is dynamic?<BR><BR>Then you can work with an array with all the numbers:<BR><BR>Function MinInt(arrNumbers) <BR>Dim x, i<BR>x = 10000<BR><BR>For i = 0 To UBound(arrNumbers) <BR> If arrNumbers(i) &#060; x Then x = arrNumbers(i) <BR>Next<BR><BR>MinInt = x <BR>End Function

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•