+ Reply to Thread
Results 1 to 5 of 5

Lookup but ignore blanks

  1. #1
    Forum Contributor
    Join Date
    08-23-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    139

    Lookup but ignore blanks

    Hi,

    On my transactions sheet I have a massive list of product transaction (such as stock movements and orders). In this list, the same product can appear hundreds of times, but not every column has data in it all the time. As an example, when an order is processed, the "stock quantity" column is left blank, since that particular transaction doesn't care how many are in stock, it instead puts a -1 in the "orders" column. My question:

    Obviously, if i do a lookup for a particular product it is going to find the first instance where the product code matches the one i'm looking for and return that value and sometimes that will be a blank. I'm currently using a lookup that looks UP the transaction list so that it catches the last and most recent data first...

    Please Login or Register  to view this content.
    I have no problem in using some function other than the lookup, so long as it isn't going to cause an issue if I have 50+ cells running the same formula when a product code is entered into B28, and the result can be a number or text.

    In pseudo-code, my formula would do this:

    =
    if cell 28 is blank, leave my cell blank otherwise

    look from the bottom of the transactions list, column A, for a match to B28 and

    when a match is found, check for a value >0 in column F

    if the cell is blank, keep moving up the rows until you find a >0 value otherwise

    give the value in column F
    I hope my description is useful, and thanks in advance for the help I will receive

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Lookup but ignore blanks

    Maybe ...

    =IF($B28="", 0, LOOKUP(2,1/(($A$3:$A$23000=$B28) * ($F$3:$F$23000>0)), $F$3:F$23000))
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Contributor
    Join Date
    08-23-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    139

    Re: Lookup but ignore blanks

    Thanks for the fast and effective response, this formula works beautifully.

    I won't resent it if you don't accept my request but would you mind telling me how this formula works? It's not the first time I've come across the * within a lookup and I just can't think of how it would make the difference?

    From what i can tell, the formula look for the number of times that b28 = cells in colA and colF >0, then returns the value in colF. I don't understand how that somehow means it omits the times when colF =<0

    This is a chance for me to learn something valuable here, and i'm happy if you can link me to something that can explain the use of * in formulas.

    Thanks again for the solution

  4. #4
    Forum Contributor
    Join Date
    08-23-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    139

    Re: Lookup but ignore blanks

    Thanks for the fast and effective response, this formula works beautifully.

    I won't resent it if you don't accept my request but would you mind telling me how this formula works? It's not the first time I've come across the * within a lookup and I just can't think of how it would make the difference?

    From what i can tell, the formula look for the number of times that b28 = cells in colA and colF >0, then returns the value in colF. I don't understand how that somehow means it omits the times when colF =<0

    This is a chance for me to learn something valuable here, and i'm happy if you can link me to something that can explain the use of * in formulas.

    Thanks again for the solution

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Lookup but ignore blanks

    In this ...

    1/($A$3:$A$23000=$B28)

    you have a logical expression in the denominator. When logical expressions are used in arithmetic, Excel converts True to 1 and False to 0. So the result looks something like

    #DIV/0!, 1, #DIV/0!, #DIV/0!, 1, #DIV/0!, ...

    Lookup only matches values of like type to the lookup value (here, the number 2), and ASSUMES that the array is in ascending order. Since all values are less than 2, it returns the last 1.

    Changing that to this

    1/(($A$3:$A$23000=$B28) * ($F$3:$F$23000>0))

    just extends the paradigm; both logical expressions are converted to 1's and 0's to be multiplied.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Sumproduct to ignore blanks
    By Dgp2012 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 03-16-2020, 02:07 PM
  2. [SOLVED] MIN/MAX IF To Ignore Blanks
    By splendidus in forum Excel General
    Replies: 2
    Last Post: 07-04-2012, 04:00 PM
  3. Concatenate and ignore blanks
    By nujwaan in forum Excel Programming / VBA / Macros
    Replies: 28
    Last Post: 09-24-2009, 11:23 AM
  4. Concatenate and ignore blanks
    By nujwaan in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-22-2009, 04:25 AM
  5. USING IGNORE BLANKS IN FORMULA
    By Roger H. in forum Excel General
    Replies: 5
    Last Post: 04-06-2005, 12:06 PM

Tags for this Thread

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