+ Reply to Thread
Results 1 to 4 of 4

Using Index Function to Find 1st non Blank Cell (From the right)

  1. #1
    Registered User
    Join Date
    05-27-2010
    Location
    NYC
    MS-Off Ver
    Excel 2003
    Posts
    4

    Using Index Function to Find 1st non Blank Cell (From the right)

    Hi all -

    I have data in columns A-X, in a "tree like" hierarchy, so I would like to have a formula in column Y that will find the first non blank cell from A-X and return the result. For Example, row 2 non blank cell may be in Column C and row 3 may be in column X (depending on the depth).

    Can this be modified to look up from the Right to the left?

    =INDEX(B2:X2,MATCH(TRUE,INDEX((B2:X2<>0),0),0))


    many thanks...

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Using Index Function to Find 1st non Blank Cell (From the right)

    Try

    =LOOKUP(2,1/(B2:X2<>0),B2:X2)
    Audere est facere

  3. #3
    Registered User
    Join Date
    05-27-2010
    Location
    NYC
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Using Index Function to Find 1st non Blank Cell (From the right)

    Quote Originally Posted by daddylonglegs View Post
    Try

    =LOOKUP(2,1/(B2:X2<>0),B2:X2)
    Thanks - that looks up well from the right, however returns the first blank cell, rather than going deeper into the rows to find a non-blank cell...

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Using Index Function to Find 1st non Blank Cell (From the right)

    Your formula

    =INDEX(B2:X2,MATCH(TRUE,INDEX((B2:X2<>0),0),0))

    Is specifically looking for the first non-zero cell, which isn't necessarily the same as the first "non-blank" cell

    This formula

    =LOOKUP(2,1/(B2:X2<>0),B2:X2)

    will find the last "non zero" cell in the range. If it returns a blank then perhaps you have formulas in the range that return blanks? If so try changing to

    =LOOKUP(2,1/(B2:X2<>""),B2:X2)

    ....but if the last non blank cell is a zero it will return that value, is that OK? Also your original formula could return a blank if you have "formula blanks" in the range

+ 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