Excel User Group
Microsoft Excel blogs, forums, files. Read, ask questions, provide answers.

Finding the first number larger than ....

Latest post Thu, Feb 4 2010 7:26 AM by Bob Phillips. 3 replies.
  • Thu, Feb 4 2010 4:03 AM

    • Gizmo
    • Top 10 Contributor
    • Joined on Mon, Jan 21 2008
    • Hampshire, England
    • Posts 76
    • Points 1,222

    Finding the first number larger than ....

    Hi,

    I can solve this using code, a UDF or a helper column but if possible I'd like to tidy it up by using a formula. I think it'll probably be an array formula of some kind but that's not my strong point.

    Here goes:

    A range, say A1 thru A20 is populated with numbers in a random order.
    Cell C1 has a threshold number.

    What I'd like to know is the number of the entry in the list that first breaches the threshold. So for example, the 11th entry is the first above the threshold.

    Can anyone help?
    Thanks

    Gary

     

    Motto? "There's always a better way" - all you have to do is find it!

    • Post Points: 21
  • Thu, Feb 4 2010 6:28 AM In reply to

    Re: Finding the first number larger than ....

    Not even an array formula

     

    =INDEX(A1:A20,MATCH(TRUE,INDEX(A1:A20>C1,0),))

    Regards

    Bob

    • Post Points: 21
  • Thu, Feb 4 2010 6:56 AM In reply to

    • Gizmo
    • Top 10 Contributor
    • Joined on Mon, Jan 21 2008
    • Hampshire, England
    • Posts 76
    • Points 1,222

    Re: Finding the first number larger than ....

    Sweet, thanks Bob.

    Finds the first value above the threshold; wrap it all in a MATCH and I've got the location. :)

    It's the snippets that make all the difference like, in this case, knowing you can put a condition in an INDEX and match on the test against the condition.
    Very useful to know!

    Motto? "There's always a better way" - all you have to do is find it!

    • Post Points: 21
  • Thu, Feb 4 2010 7:26 AM In reply to

    Re: Finding the first number larger than ....

    Also not the usage of 0 as an argument to the INDEX function, that means that INDEX returns an array of values.

    Regards

    Bob

    • Post Points: 5
Page 1 of 1 (4 items) | RSS
Copyright Excel User Group and the relevant contributors, 2009. All Trade Marks acknowledged. This site is a peer-to-peer site and NOT affiliated in any way to Microsoft Corp. All rights reserved.