+ Reply to Thread
Results 1 to 7 of 7

Trying to find first and last 15 cells with data within range - how to ignore blanks?

  1. #1
    Registered User
    Join Date
    11-01-2010
    Location
    Planet, Earth
    MS-Off Ver
    Excel 2010
    Posts
    11

    Trying to find first and last 15 cells with data within range - how to ignore blanks?

    Hi,

    Trying to find the first and last 15 cells within a range that contains data - however, there are some blanks between the cells (of varying intervals).

    I was able to use the formula post here by NBVC for a range that did NOT have blanks:

    =INDEX(All_Data_sheet!A:A,MATCH(REPT("z",255),All_Data_sheet!$A:$A)-10+ROWS($A$1:$A1))

    However, this does not work with my new ask.

    Thank you,
    Rich

  2. #2
    Registered User
    Join Date
    11-01-2010
    Location
    Planet, Earth
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Trying to find first and last 15 cells with data within range - how to ignore blanks?

    Update:

    Found a formula to find the FIRST 15, ignoring the blanks by using the array:

    =IF(ROWS(L$1:L6)>COUNTA(B:B),"",INDEX(B:B,SMALL(IF(B$2:B$256<>"",ROW(B$2:B$256)),ROWS(L$1:L6))))

    How would I adjust this formula to find the LAST 15?

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,745

    Re: Trying to find first and last 15 cells with data within range - how to ignore blanks?

    Try replacing SMALL with LARGE.....

    You can also use IFERROR in Excel 2010 to shorten a little, i.e. for last value try this formula

    =IFERROR(INDEX(B:B,LARGE(IF(B$2:B$256<>"",ROW(B$2:B$256)),ROWS(L$1:L1))),"")

    confirm with CTRL+SHIFT+ENTER and copy down for 2nd last, 3rd last etc......
    Audere est facere

  4. #4
    Registered User
    Join Date
    11-01-2010
    Location
    Planet, Earth
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Trying to find first and last 15 cells with data within range - how to ignore blanks?

    Quote Originally Posted by daddylonglegs View Post
    Try replacing SMALL with LARGE.....

    You can also use IFERROR in Excel 2010 to shorten a little, i.e. for last value try this formula

    =IFERROR(INDEX(B:B,LARGE(IF(B$2:B$256<>"",ROW(B$2:B$256)),ROWS(L$1:L1))),"")

    confirm with CTRL+SHIFT+ENTER and copy down for 2nd last, 3rd last etc......
    Perfect, thank you.

  5. #5
    Registered User
    Join Date
    11-01-2010
    Location
    Planet, Earth
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Trying to find first and last 15 cells with data within range - how to ignore blanks?

    Adding on to my original post -

    The array takes the bottom 15 cells with data, but returns beginning with the last row - Is there a code where I can get the bottom 15 of, for example, a 30 row range but start with row 16?

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,745

    Re: Trying to find first and last 15 cells with data within range - how to ignore blanks?

    The ROWS part at the end is giving you 1 then 2 then 3 etc so if you make it 16-ROWS(L$1:L1) that will go from 15 to 14 to 13 etc. so that will look like this:

    =IFERROR(INDEX(B:B,LARGE(IF(B$2:B$256<>"",ROW(B$2:B$256)),16-ROWS(L$1:L1))),"")

    If there are fewer than 15 entries then the first rows will be blank.....

  7. #7
    Registered User
    Join Date
    11-01-2010
    Location
    Planet, Earth
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Trying to find first and last 15 cells with data within range - how to ignore blanks?

    Quote Originally Posted by daddylonglegs View Post
    The ROWS part at the end is giving you 1 then 2 then 3 etc so if you make it 16-ROWS(L$1:L1) that will go from 15 to 14 to 13 etc. so that will look like this:

    =IFERROR(INDEX(B:B,LARGE(IF(B$2:B$256<>"",ROW(B$2:B$256)),16-ROWS(L$1:L1))),"")

    If there are fewer than 15 entries then the first rows will be blank.....
    So sick, thank you.

+ 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