+ Reply to Thread
Results 1 to 22 of 22

Return non-blank Cells from a Range

  1. #1
    Forum Contributor
    Join Date
    08-19-2009
    Location
    Netherlands, Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    585

    Return non-blank Cells from a Range

    Hi all,

    Is there a non-array way to return only the non-blank cells from a range?
    At the moment I use below formula, but it slows down the file considerably

    Please Login or Register  to view this content.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Return non-blank Cells from a Range

    filter, then copy paste
    or even.
    go to/special blanks and delete
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Forum Contributor
    Join Date
    08-19-2009
    Location
    Netherlands, Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    585

    Re: Return non-blank Cells from a Range

    Quote Originally Posted by martindwilson View Post
    filter, then copy paste
    or even.
    go to/special blanks and delete
    Hello Martin,

    Problem is that the data is the result of several parameters and is continually changing.
    So I need a formula for this

  4. #4
    Registered User
    Join Date
    06-20-2010
    Location
    ShenZhen China
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Return non-blank Cells from a Range

    try this array formula
    =if(row(1:1)>counta($D$4:$D$50),"",INDEX($D$4:$D$50,MATCH(,COUNTIF($E$2:E3;$D$4:$D$50),)))

  5. #5
    Forum Contributor
    Join Date
    05-16-2010
    Location
    UK
    MS-Off Ver
    2003 and 2007
    Posts
    252

    Re: Return non-blank Cells from a Range

    Try this (no need to confirm with Ctrl+Shift+Enter):

    Excel 2003:
    =IF(ISERROR(INDEX(D:D,SMALL(INDEX(NOT(ISBLANK($D$2:$D$20))*ROW($D$2:$D$20),0),COUNTBLANK($D$2:$D$20)+ROW(D1)))),"",INDEX(D:D,SMALL(INDEX(NOT(ISBLANK($D$2:$D$20))*ROW($D$2:$D$20),0),COUNTBLANK($D$2:$D$20)+ROW(D1))))

    Excel 2007:
    =IFERROR(INDEX(D:D,SMALL(INDEX(NOT(ISBLANK($D$2:$D$20))*ROW($D$2:$D$20),0),COUNTBLANK($D$2:$D$20)+ROW(D1))),"")
    Attached Files Attached Files
    Last edited by pb71; 07-04-2010 at 02:18 PM. Reason: Excel 2003 formula +ROW(D2) corrected to +ROW(D1) and example workbook attached

  6. #6
    Forum Contributor
    Join Date
    08-19-2009
    Location
    Netherlands, Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    585

    Re: Return non-blank Cells from a Range

    Awesome, thanks PB!
    Last edited by Cutter; 10-29-2012 at 04:33 PM. Reason: Removed whole post quote

  7. #7
    Registered User
    Join Date
    06-27-2012
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2011
    Posts
    1

    Re: Return non-blank Cells from a Range

    Kick ***!
    Thanks for posting this, I was hitting plenty of dead ends trying to figure this out myself with Index-Match functions.

    Best
    Andy

  8. #8
    Registered User
    Join Date
    01-09-2012
    Location
    Canada
    MS-Off Ver
    Excel 2011
    Posts
    3

    Re: Return non-blank Cells from a Range

    Hi Andy. Could you please tell me what is the Index-Match formula that you came up with as I am looking for the same thing ?

    Thanks

    Dany

  9. #9
    Registered User
    Join Date
    11-29-2012
    Location
    Europe
    MS-Off Ver
    Excel 2003, 2007
    Posts
    26

    Re: Return non-blank Cells from a Range

    Deleted post.
    Started new thread.
    Last edited by Mecha_Trueno; 05-30-2013 at 08:48 AM.

  10. #10
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Return non-blank Cells from a Range

    Mecha,

    Unfortunately you need to post your question in a new thread, it's against the forum rules to post a question in the thread of another user. If you create your own thread, any advice will be tailored to your situation so you should include a description of what you've done and are trying to do. Also, if you feel that this thread is particularly relevant to what you are trying to do, you can surely include a link to it in your new thread.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  11. #11
    Registered User
    Join Date
    11-21-2013
    Location
    Naples, Florida
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Return non-blank Cells from a Range

    Attachment 279560

    Hi pb71,

    Thank you for the solution, but this doesn't seem to work for larger ranges with more blanks. Can you take a look at my attached file and let me know if you have a new solution?

    Thanks,
    Doug

  12. #12
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Return non-blank Cells from a Range

    douge1238,

    Unfortunately you need to post your question in a new thread, it's against the forum rules to post a question in the thread of another user. If you create your own thread, any advice will be tailored to your situation so you should include a description of what you've done and are trying to do. Also, if you feel that this thread is particularly relevant to what you are trying to do, you can surely include a link to it in your new thread.

  13. #13
    Registered User
    Join Date
    11-21-2013
    Location
    Naples, Florida
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Return non-blank Cells from a Range

    arlu1201,

    It's not really a new question if the "solution" doesn't work...

  14. #14
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Return non-blank Cells from a Range

    Sometimes the solution you require could be completely different than the original posters solution, hence we encourage to post in a new thread to avoid confusing other users who read this thread.

  15. #15
    Registered User
    Join Date
    03-12-2010
    Location
    channai
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: Return non-blank Cells from a Range

    Quote Originally Posted by Andyprince View Post
    Kick ***!
    Thanks for posting this, I was hitting plenty of dead ends trying to figure this out myself with Index-Match functions.

    Best
    Andy
    Hi Andy,

    I need yor help, if we have more than one column means how can i put formual. Excel attached.

    Thanks in advance,
    Guna.S
    Attached Files Attached Files
    Last edited by sguna1982; 06-04-2014 at 08:07 AM. Reason: Attachment missing

  16. #16
    Registered User
    Join Date
    08-17-2009
    Location
    Ukraine
    MS-Off Ver
    Excel 2010
    Posts
    46

    Re: Return non-blank Cells from a Range

    Quote Originally Posted by sguna1982 View Post
    Hi Andy,

    I need yor help, if we have more than one column means how can i put formual. Excel attached.

    Thanks in advance,
    Guna.S

    This is what I've been looking for...

    But no one could solve the problem yet....

    My brain will explode thinking about this...

    Help us please !

  17. #17
    Registered User
    Join Date
    03-03-2015
    Location
    Jacksonville, FL
    MS-Off Ver
    2003 and 2010
    Posts
    2

    Re: Return non-blank Cells from a Range

    I realize that this is an old post, but I've just had a similar need to return all non-blank cells of a row. However, instead of the value in the cell, how may I make use of the INDEX function to return the header row???

  18. #18
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Return non-blank Cells from a Range

    Please start your own thread.

    The solution is relatively easy!
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  19. #19
    Registered User
    Join Date
    05-10-2016
    Location
    Ankara
    MS-Off Ver
    Office 365
    Posts
    1

    Re: Return non-blank Cells from a Range

    Thank you for the file

  20. #20
    Registered User
    Join Date
    10-16-2017
    Location
    India
    MS-Off Ver
    2007
    Posts
    2

    Re: Return non-blank Cells from a Range

    Thanks bro

  21. #21
    Registered User
    Join Date
    10-16-2017
    Location
    India
    MS-Off Ver
    2007
    Posts
    2

    Re: Return non-blank Cells from a Range

    Thanks Bro

  22. #22
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,728

    Re: Return non-blank Cells from a Range

    Mr. Manish - what is the purpose of your posts? Whom are you thanking and why?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

+ 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