+ Reply to Thread
Results 1 to 3 of 3

Function that identifies cell in a range that is X lower than the previous max?

  1. #1
    Registered User
    Join Date
    03-25-2013
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    61

    Function that identifies cell in a range that is X lower than the previous max?

    Howdy Excel Geniuses!

    I'm trying to create a function (UDF) that looks at the next Y rows of data (a 1-dimensional array, let's call it 15 rows), and identifies the first place where the next row tested is more than X amount less than whatever the previous maximum value in the array was.

    So if X=3, and our array is: 10,9,8,9,11,12,11,13,12,10,9,10,8,7,6 ...

    The 10 in bold is the first cell where the next value is 3 points lower than the previous high of 13.


    I originally wanted to perform this using a formula comprised of Excel's own functions, but I haven't been able to figure it out!

    I'm a complete novice with VBA and haven't been able to get a proper For ... Next loop working...

    Oh, and if it makes any difference: Y and X are variables that are stored at the top of the spreadsheet. I'm not sure whether the VBA function should create new variables for them, or just use Range.() ...

    Can anyone help?

    Thanks!
    Last edited by hadamhiram; 03-27-2013 at 03:11 PM.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,963

    Re: Function that identifies cell in a range that is X lower than the previous max?

    heres a formula solution. The calculation columns can be hidden.
    Attached Files Attached Files
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    03-25-2013
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    61

    Re: Function that identifies cell in a range that is X lower than the previous max?

    That's very helpful, thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1