+ Reply to Thread
Results 1 to 6 of 6

Copying rows excluding blanks

  1. #1
    Registered User
    Join Date
    01-07-2018
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    39

    Copying rows excluding blanks

    Hi,

    I have been searching the forum for threads on how to transfer the info from a source table into a new table on the same sheet, but removing rows where a cell is blank. I wanted to do this without affecting the original table.

    It seems that a combination of the Vlookup and IFERROR functions might do it, but I do not know exactly how.

    I have uploaded an example that includes a source table, and a second table on the same sheet that I was hoping the formula would output. Hopefully this is possible.

    Thanks
    Attached Files Attached Files

  2. #2
    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,830

    Re: Copying rows excluding blanks

    Welcome to the forum!

    In L5:

    =IFERROR(INDEX(A:A,SMALL(IF($B$5:$B$23<>"",ROW($A$5:$A$23)),ROWS($A$1:A1))),"")

    In M5:

    =IFERROR(INDEX(B:B,SMALL(IF($B$5:$B$23<>"",ROW($A$5:$A$23)),ROWS($A$1:A1))),"")

    ... both confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Then drag copy down.

    You can adapt these for the other columns.
    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.

  3. #3
    Registered User
    Join Date
    01-07-2018
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    39

    Re: Copying rows excluding blanks

    Hi AliGW,

    Thank you so much - this worked perfectly!

    I was having real trouble figuring it out myself. Thank you for your time.

    One last thing: do you think you would mind writing what the function means in sentence form? I am curious to figure out where I was going wrong!

    Thanks again.

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,559

    Re: Copying rows excluding blanks

    A way to see what a formula is doing is to use the Evaluate Formula feature which is on the Formulas tab of version 2010, so I hope it is still the same on the 365 version. You'll see that the $B$5:$B$23<>"" part of the formula produces an array of true's and false's. That array is then combined with the numeric values produced by the ROW($A$5:$A$23) part to yield an array of numeric values and false's. The last part, ROWS($A$1:A1), tells the SMALL function which number to pick so that the INDEX function gets the correct row from column B. I hope that this helps.
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  5. #5
    Registered User
    Join Date
    01-07-2018
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    39

    Re: Copying rows excluding blanks

    Thank you very much, that explains it very well.

    Thanks again for your help.

  6. #6
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,559

    Re: Copying rows excluding blanks

    You're Welcome. Thank You for the feedback and for marking the thread as 'Solved'. I hope that you have a blessed day.

+ 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: 9
    Last Post: 02-08-2016, 11:25 AM
  2. Replies: 1
    Last Post: 02-02-2016, 04:53 PM
  3. [SOLVED] Insert and Delete blanks rows so that there are 2 blanks rows between text rows
    By erniedawg in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-29-2013, 02:27 AM
  4. [SOLVED] MIN value excluding blanks
    By coach.32 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-19-2013, 04:52 PM
  5. VBA: Copying multiple rows to new sheet with no blanks
    By vultimitamin in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-31-2012, 11:30 AM
  6. Linking List While Excluding Blanks
    By hgb in forum Excel General
    Replies: 5
    Last Post: 04-26-2011, 03:11 PM
  7. [SOLVED] Count IF excluding blanks or zeroes
    By Ash in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-02-2006, 07:45 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