+ Reply to Thread
Results 1 to 10 of 10

Copying non-blank cell data into another sheet

  1. #1
    Registered User
    Join Date
    06-10-2015
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    47

    Copying non-blank cell data into another sheet

    Hello,

    I know it is possible to copy the non-blanks cells data into another sheet using VB. But is this possible to do using excel formulas?

    please let me know.
    thanks

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,705

    Re: Copying non-blank cell data into another sheet

    Copy, no. Reference with a formula, yes. Can you be more specific?

    For example, if you put this formula in A1 and copy to the right and down, it will show all non-blank values in Sheet1.

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


    Hard to tell if that's what you mean.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Copying non-blank cell data into another sheet

    Or, you could apply filters, (ask, if you dont know how to), filter on non-blanks, copy what remains to the new location, remove/undo filters. You could even record a macro to do that for you
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Registered User
    Join Date
    05-27-2015
    Location
    Zagreb
    MS-Off Ver
    2010
    Posts
    36

    Re: Copying non-blank cell data into another sheet

    Here is example of VBA code

    Please Login or Register  to view this content.
    This code filters data in Sheet 4 as per criteria cell is blank in column 3 and copy paste selection to sheet5.

    Regards,

    Tanja
    Last edited by 6StringJazzer; 06-11-2015 at 07:17 AM. Reason: corrected error in code tags

  5. #5
    Registered User
    Join Date
    05-27-2015
    Location
    Zagreb
    MS-Off Ver
    2010
    Posts
    36

    Re: Copying non-blank cell data into another sheet

    Correction, previous code was returning blank. This one should be OK

    Please Login or Register  to view this content.

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

    Re: Copying non-blank cell data into another sheet

    Try this...

    Sheet1
    A
    1
    Header
    2
    Data1
    3
    Data2
    4
    5
    6
    Data3
    7
    Data4
    8
    9
    Data5
    10


    Sheet2
    A
    1
    Header
    2
    Data1
    3
    Data2
    4
    Data3
    5
    Data4
    6
    Data5
    7


    This array formula** entered in A2:

    =IFERROR(INDEX(Sheet1!A:A,SMALL(IF(Sheet1!A$2:A$10<>"",ROW(Sheet1!A$2:A$10)),ROWS(A$2:A2))),"")

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

    Copy down until you get blanks.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  7. #7
    Registered User
    Join Date
    06-10-2015
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    47

    Re: Copying non-blank cell data into another sheet

    Quote Originally Posted by Tony Valko View Post
    Try this...

    Sheet1
    A
    1
    Header
    2
    Data1
    3
    Data2
    4
    5
    6
    Data3
    7
    Data4
    8
    9
    Data5
    10


    Sheet2
    A
    1
    Header
    2
    Data1
    3
    Data2
    4
    Data3
    5
    Data4
    6
    Data5
    7


    This array formula** entered in A2:

    =IFERROR(INDEX(Sheet1!A:A,SMALL(IF(Sheet1!A$2:A$10<>"",ROW(Sheet1!A$2:A$10)),ROWS(A$2:A2))),"")

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

    Copy down until you get blanks.
    Hi,

    sorry for the delay, i tried to enter some data after row 10 in sheet 1, it does not seem to copy them into sheet 2 when using your formula, do you know why?

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

    Re: Copying non-blank cell data into another sheet

    You would need to extend the range in the formula. In the sample formula I only reference down to A10. Extend this as needed.

  9. #9
    Registered User
    Join Date
    06-10-2015
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    47

    Re: Copying non-blank cell data into another sheet

    thanks. it worked

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

    Re: Copying non-blank cell data into another sheet

    You're welcome. Thanks for the feedback!


    If your question has been solved please mark the thread as being solved.

    In the menu bar above the very first post select Thread Tools, then select Mark this thread as solved.

+ 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. Copying data from adjacent cell to blank cell (left side)
    By raghunaik in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-14-2015, 08:20 AM
  2. Copying data to the first blank cell
    By justinlucas in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-03-2013, 11:41 PM
  3. copying data to a blank sheet
    By steveg666 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-06-2013, 09:36 AM
  4. Replies: 3
    Last Post: 04-26-2012, 05:15 PM
  5. Replies: 4
    Last Post: 03-22-2011, 02:26 AM

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