+ Reply to Thread
Results 1 to 5 of 5

Formula to Copy/Paste data based on value of another cell. SKIP BLANK ROWS.

  1. #1
    Registered User
    Join Date
    06-24-2013
    Location
    Vancouver
    MS-Off Ver
    Excel 2010
    Posts
    25

    Formula to Copy/Paste data based on value of another cell. SKIP BLANK ROWS.

    Hello.

    In need a formula that looks at the value of one cell. If a condition is met then another cell is copy/pasted. This needs to continue down the worksheet but SKIP results that are blank. the pasted results must be pasted directly underneath each other row after row. No blank rows.

    How do I do this? It needs to be a formula. No VBA or Copy/Paste please.

    Example below:
    1. On "Sheet1" I have the following data in column A and B.
    2. Excel must look at column B on Sheet1. If the result is "1" then on Sheet2 paste Sheet1 column A.
    3. If Column B is NOT "1" then excel needs to SKIP that row and paste the next row directly below.

    Sheet1
    A B
    1 test1 1
    2 test2 1
    3 test3 2
    4 test4 3
    5 test5 1
    6 test6 5
    7 test7 1
    8 test8 2
    9 test9 1
    10 test10 4


    On "Sheet2" the final result needs to be:

    Sheet2
    A
    1 test1
    2 test2
    3 test5
    4 test7
    5 test9
    6
    7
    8
    9
    10

    Notice how the data is compressed. There are no blank rows in between the data. This is what I need.


    Below is the result I DO NOT want:

    Sheet2
    A
    1 test1
    2 test2
    3
    4
    5 test5
    6
    7 test7
    8
    9 test9
    10


    Here is where I am at. On "Sheet2" I could copy down a simple formula such as =IF(Sheet1!C2>1,"",Sheet1!B2). The challenge is the resulting blank rows. How do I get a result that skips the blank rows?

    Thanks for the help!

  2. #2
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: Formula to Copy/Paste data based on value of another cell. SKIP BLANK ROWS.

    Try this array formula in the Cell A1 of sheet2. Since this is an array formula so you need to confirm it with Ctrl+Shift+Enter instead of just Enter. (i.e. hold down the Ctrl + Shift and then press Enter)

    Please Login or Register  to view this content.
    For detail see the attached sheet.
    Attached Files Attached Files
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  3. #3
    Registered User
    Join Date
    06-24-2013
    Location
    Vancouver
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Formula to Copy/Paste data based on value of another cell. SKIP BLANK ROWS.

    Quote Originally Posted by sktneer View Post
    Try this array formula in the Cell A1 of sheet2. Since this is an array formula so you need to confirm it with Ctrl+Shift+Enter instead of just Enter. (i.e. hold down the Ctrl + Shift and then press Enter)

    Please Login or Register  to view this content.
    For detail see the attached sheet.
    That did the trick. Thanks for the help and quick reply!

  4. #4
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: Formula to Copy/Paste data based on value of another cell. SKIP BLANK ROWS.

    Glad to help you. Thanks for the feedback.
    If that takes care of your question, please mark your thread as solved.
    Moreover you may also click on * (star) to Add Reputation to those who have put their time and efforts to help you in this forum. This is another way to say thanks to them.

  5. #5
    Registered User
    Join Date
    05-13-2015
    Location
    Antioch, TN
    MS-Off Ver
    2007
    Posts
    1

    Re: Formula to Copy/Paste data based on value of another cell. SKIP BLANK ROWS.

    SOLVED!
    I love this solution, I'm trying to adapt it to my needs for several worksheets, where the smallest one has 676 rows of data, so naturally I really really, really want this to work. The sheet I'm having it reference is named Location, the values I want it to return are in the range A3:A678, and I'm needing it to run the IF statement off the criteria ABS($AF$3:$AF$678) >= $AC$1. What I have is:

    =IFERROR(INDEX(Location!$A$3:$A$678,SMALL(IF(ABS(Location!$AF$3:$AF$678)>=$AC$1,ROW(Location!$A$3:$A$678)-ROW(Location!$A$3)+1),ROWS(A$3:A3))),"")

    All I'm getting are blanks after I ctrl+shift+enter the formula, and then drag fill it down. Please, tell me, what am I doing wrong?

    EDIT: I figured it out: for the IF statement to work, there cannot be any blanks in that array, otherwise #VALUE shows up, and throws the entire formula into an error. Also, I needed to have the sheet reference in the last ROWS function.
    Last edited by FelixTandem; 05-14-2015 at 05:40 PM. Reason: 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. Copy Formula from set cells, paste in blank rows below as value
    By cappie in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-18-2013, 02:45 PM
  2. Paste the data into next blank rows based on the userform selection
    By krjoshi in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 12-06-2011, 10:22 PM
  3. Copy Data Based on Criteria and Paste In Next Blank Row
    By Gingeiko in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-30-2011, 02:28 AM
  4. Copy Paste Formula on Each Blank Rows
    By triaji in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-26-2010, 10:53 AM
  5. [SOLVED] copy paste formula to skip rows
    By Greg in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-08-2006, 05:42 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