I am trying to compare a list of numbers in a list box and determine which are the highest or lowest. For example given a list of 50 numbers which are the lowest 25 numbers in the list. Does anyone have any idea on how to do this?
Printable View
I am trying to compare a list of numbers in a list box and determine which are the highest or lowest. For example given a list of 50 numbers which are the lowest 25 numbers in the list. Does anyone have any idea on how to do this?
Format the numbers using the Format() function so that they all have the same nuumber of digits (left pad with leading zeroes).
Use the Sorted property of the ListBox to display the entries in order.
Retrieve the top or bottom 25 items from your list.
Tris.
since you can set a listboxs sorted property to True, (this will sort the list), then just select to top/bottom 25 etc
Ah, just had a thought...
Do you have duplicate numbers in your list?
Tris.
good point about the padding, forgot that :rolleyes:
that or you could stick em in an array and bubble sort them etc
yes there could possibly be duplicate numbers in the list
If you have duplicate numbers you will have to do what Darre1 and I already suggested, but instead of taking the first/last 25 entries you will need to code this.
Code:count = 1
a = first entry
results( count ) = a
while count < 25 do
a = next entry
if a <> results( count ) then
count = count + 1
results( count ) = a
endif
end while
you guys are awesome I appreciate the help
trisglow and i will now go back to saving small worlds and stuff :DQuote:
Originally posted by cmaroun2533
you guys are awesome I appreciate the help