Skip to main content
BreakawayPaul
Inspiring
September 6, 2011
Question

Dropping smallest numbers from list

  • September 6, 2011
  • 2 replies
  • 1491 views

I have an app that passes me a series of numbers (nine actually) that I need to total and average.  The only problem is that I need to drop the two lowest numbers before doing the math.

So for example, let's say I get these numbers:

5

4

5

2

4

1

2

4

5

I need to drop the 1 and one of the 2s, then total them and get the average number.

I was thinking about converting them to an array, but I still can't figure out how to drop the lowest two.

Any ideas?

    This topic has been closed for replies.

    2 replies

    Owainnorth
    Inspiring
    September 6, 2011

    Have you tried looking in the documentation under the conveniently-titled "array functions" section?

    1) Get them into an array (how depends on what format they're in to start with)

    2) ArraySort()

    3) ArrayDeleteAt(1)

    4) ArrayDeleteAt(1)

    5) ArraySum()

    6) ArrayAvg()

    It's like some kind of Function Bingo, I reckon you've got most of the available functions used there.

    BreakawayPaul
    Inspiring
    September 6, 2011

    Owainnorth wrote:

    Have you tried looking in the documentation under the conveniently-titled "array functions" section?


    I was actually looking at that when I was typing the post, but doing two ArrayDeleteAts seemed a little clunky and I wondered if there was an easier/better way.

    BUT, I guess if it works it works!

    Inspiring
    September 6, 2011

    listSort()

    listRest()

    listRest()

    --

    Adam