+ Reply to Thread
Results 1 to 5 of 5

Excel 2007 : Find next 'less than' value, ignoring blanks

  1. #1
    Registered User
    Join Date
    09-07-2009
    Location
    Sydney
    MS-Off Ver
    Excel 2007
    Posts
    26

    Find next 'less than' value, ignoring blanks

    Hi

    Need to find the next value that is less than 'x', however it needs to ignore blanks, which is what its currently getting stuck on.

    The current formula
    =IFERROR(ROW(INDEX((INDIRECT("'"&$B216&"'!C"&ROW()+1&":C10000")),SUMPRODUCT(MATCH(1,--((INDIRECT("'"&$B216&"'!C"&ROW()+1&":C10000"))<D216),0)),1)),"NO SALE")

    The problem is that it returns cells that have a blank(zero) in them. Is there a way to have it skip blank cells - the required value will never be zero.

    Note the blank cell is a tab from a tab separated CSV file.

    Cheers

    Sam

  2. #2
    Valued Forum Contributor JeanRage's Avatar
    Join Date
    03-02-2009
    Location
    Nice, France
    MS-Off Ver
    Excel 2003
    Posts
    705

    Re: Find next 'less than' value, ignoring blanks

    Hi,

    Quite difficult to decypher without your file ...
    Try to add
    *(A1:A100<>"")
    within your Sumproduct() element ...

    HTH

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Find next 'less than' value, ignoring blanks

    Sam, it seems as though if a value exists you're returning the row number rather than the value - is that the desired output ?

    I ask because you mention
    Quote Originally Posted by Sam
    Need to find the next value that is less than 'x'
    If it is your intention to simply return the row number then as I see it based on your present formulae you could remove the whole ROW/INDEX element and simply add ROW() to your SUMPRODUCT result so as to return the Row number of the MATCH as
    found by the SUMPRODUCT

    eg

    Please Login or Register  to view this content.
    Are you able to post a sample file that mimics your real setup (and outline desired results) ?
    Last edited by DonkeyOte; 12-12-2009 at 04:15 AM.

  4. #4
    Registered User
    Join Date
    09-07-2009
    Location
    Sydney
    MS-Off Ver
    Excel 2007
    Posts
    26

    Re: Find next 'less than' value, ignoring blanks

    Please find attached XLSX file.

    Quote Originally Posted by D.O
    Sam, it seems as though if a value exists you're returning the row number rather than the value - is that the desired output ?
    Apologies, you are correct - I need the row number of the value, not the value itself.

    The Analysis Sheet on row 203 has this data
    CP8 143.670000 143.655633
    SO, got to Sheet CP8, look down Col C, and find a value less than or equal to 143.655633.
    Thats the job of the formula in cell Analysis!E203, which is the one I posted above.

    What is returning is CP8!206, which contains a blank. It should have returned row 207, which has a 142 value.

    Any help much appreciated.

    Cheers

    Sam
    Attached Files Attached Files
    Last edited by DonkeyOte; 12-12-2009 at 07:13 AM. Reason: added quote tags

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Find next 'less than' value, ignoring blanks

    Your existing approach would become:

    Please Login or Register  to view this content.
    However it's worth pointing out that each of these SUMPRODUCT is Volatile and each is referencing close on 20000 cells ... that's going to be very (very) bad news for the performance of your file

    If I were to make a suggestion... it would be this:

    Calculate the position of the "next low value" in each row on the Target sheet where you have a value in B (eg somewhere on CP8 row 204, 205 etc etc...)

    You can then use a less expensive formula approach from your Summary sheet - ie along the lines of your existing LOOKUP approach in column C.

    eg

    Please Login or Register  to view this content.
    Then

    Please Login or Register  to view this content.
    Given the sheet variable nature of your functions you can't (with native formulae) avoid Volatility however when using Volatile approaches it is imperative that the functions used are not memory hungry - ie avoid Volatile Arrays & Sumproducts like the plague.

+ 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