+ Reply to Thread
Results 1 to 5 of 5

Find Position of Next Nonblank Cell in Range

  1. #1
    Forum Contributor
    Join Date
    03-26-2015
    Location
    Cookeville, TN
    MS-Off Ver
    Excel 365
    Posts
    221

    Find Position of Next Nonblank Cell in Range

    Seems like this should be pretty easy, but I'm not having much luck! I am using MATCH to find the position of a specified value within the first column of a table. This column contains numeric values (formatted as General, typically in ascending order but could be in any order) but also with many blank cells interspersed. Having found the value I'm looking for (in the first column), I then want to do some additional lookups, in the other columns of the table, but only in the range that extends down to the next nonblank cell in the first column. For example, in the image below, if I search for the value of 7 (in the leftmost column), then I want to do further lookups within the blue-shaded range (other columns are blank in this example, but would actually contain data):

    Screenshot.png

    My problem is: How do I find the position of the next non-blank cell (in the leftmost column), so I know how to set the (blue-shaded) range for my subsequent lookups? I am using:

    =MATCH(TRUE,OFFSET(TableCol1,FoundRow,0,ROWS(TableCol1)-FoundRow,1)>0,0)

    where TableCol1 is $C$4:$C$33 and FoundRow is the looked-up position of 7 within this column (in this case, FoundRow = 6). But this gives me a #N/A error. This is driving me nuts because a similar formula "=MATCH(TRUE,[Specified range using OFFSET function]>0,0)" works fine in another spreadsheet I have. What am I doing wrong?

    I know the OFFSET function by itself is working OK, because =SUM(OFFSET(TableCol1,FoundRow,0,ROWS(TableCol1)-FoundRow,1)) gives the correct result. So why won't MATCH(TRUE,[Range]>0,0) work for me? I've also tried MATCH(TRUE,[Range]<>"",0) and MATCH(FALSE,[Range]="",0) but they don't work, either. Help, please!!
    Sample file is attached:
    Test File (MATCH to Find Next Non-Empty Cell).xls

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,063

    Re: Find Position of Next Nonblank Cell in Range

    Your formula will work if you press ctrl+shift+enter since that's array formula.
    But it will return wrong number. You need to OFFSET it for that value that you get.

    Try this (Confirmed with ctrl+****+enter, not just enter):

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Never use Merged Cells in Excel

  3. #3
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: Find Position of Next Nonblank Cell in Range

    Hello
    Amending your formula for the next non blank row, this gives the row:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Hope this helps.
    DBY

  4. #4
    Forum Contributor
    Join Date
    03-26-2015
    Location
    Cookeville, TN
    MS-Off Ver
    Excel 365
    Posts
    221

    Re: Find Position of Next Nonblank Cell in Range

    Thanks to you both!

    zbor, I am kicking myself now that I see (in my spreadsheet where a similar formula works) that it was indeed entered as an array formula! Of course! Thanks for reminding me of what I should have realized!

    DBY, I like your solution even better (I prefer to avoid array formulas where possible). I was hoping for a solution that would work even if the values were NOT in order, but in my current tables the values are in ascending order, so your solution will work.

  5. #5
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: Find Position of Next Nonblank Cell in Range

    Thanks for the Rep mark.

    DBY

+ 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. Replies: 3
    Last Post: 10-22-2014, 07:36 PM
  2. Lookup up a value off another sheet according to nonblank x,y position.
    By domppa in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-10-2014, 05:08 AM
  3. Offset until find the first nonblank cell
    By brianp in forum Excel General
    Replies: 5
    Last Post: 01-20-2012, 05:13 AM
  4. Find the last nonblank cell
    By janjan_376 in forum Excel General
    Replies: 5
    Last Post: 08-21-2009, 12:39 PM
  5. please help: find nonblank cell in group of cells...
    By spanic in forum Excel General
    Replies: 2
    Last Post: 08-08-2006, 05:07 PM
  6. Find first nonblank cell row # in pivot table using MATCH
    By Space Elf in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-14-2006, 05:55 PM
  7. [SOLVED] Find last nonblank cell in column
    By Pink Panther in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-20-2005, 08:05 PM

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