Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to copy and paste only non-blank cells in Excel?

Most of us may be suffered with this problem, when we copy a list of data which contain some blank cells, and then paste them to another column, the blank cells will also be pasted as well. This is very annoying when we don’t need the blanks and want to paste non-blank cells only. In this case, how could we copy and paste only non-blank cells in Excel quickly and conveniently? Here are some quick tricks for you to solve it:

Copy and paste only non-blank cells with Go To Special command

Copy and paste only non-blank cells with Filter feature

Copy and paste only non-blank cells with Array Formula

Copy and paste only non-blank cells with VBA code

Copy and paste only non-blank cells with Kutools for Excel good idea3


good idea2Select Nonblank Cells(quickly select non-blank cells from a selection or whole sheet.)

doc select nonblank cell 1


arrow blue right bubble Copy and paste only non-blank cells with Go To Special command


With the Go To Special command, you can select all the data first, and then copy and paste them to another location.

1. Select your list of data that you want to use.

doc-copy-only-nonblanks1

2. Then click Home > Find & Select > Go To Special, see screenshot:

doc-copy-only-nonblanks1

3. In the Go To Special dialog box, check Constants option, see screenshot:

doc-copy-only-nonblanks1

4. Then click OK, and only the value cells have been selected in the list.

doc-copy-only-nonblanks1

5. And then copy and paste the data to a location that you want. And only the non-blank cell values have been pasted. See screenshot:

doc-copy-only-nonblanks1

Note: This method only be available for the constants, it is not applied to the formula cells.


arrow blue right bubble Copy and paste only non-blank cells with Filter feature

The Filter feature can help you filter the non-blank cells first, and then you can copy and paste them to another cells as you need.

2. Click Data > Filter, see screenshot:

doc copy only nonblanks6

3. Then click the drop down button at the right corner of the cell in the selected list, and uncheck the Blanks option under the drop down menu. See screenshot:
doc-copy-only-nonblanks1

4. And then click OK, all the non-blank cells have been filtered out as following screenshot shown:

doc-copy-only-nonblanks1

5. At last, you can copy the filtered data and paste them to any location you need.

Note: Both values and formulas are taken effect by using this way.


arrow blue right bubble Copy and paste only non-blank cells with Array Formula

To copy and paste only the non-blank cells, you can also apply the following array formula.

formula Never need to worry about long long formulas in Excel anymore! Kutools for Excel's Auto Text can add all formulas to a group
as auto text, and liberate your brain! Click here to know Auto Text     Click here to get free trial

1. Besides your data, enter the following formula to a blank cell:

=LOOKUP("zzzzz",CHOOSE({1,2},"",INDEX(A:A,SMALL(IF($A$1:$A$15<>"",ROW($A$1:$A$15)),ROWS($B$1:B1)))))

doc-copy-only-nonblanks1

Note: In the above formula, A1:A15 is the data list that you want to use.You can change it to your need.

2. Then press Shift + Ctrl + Enter keys together, and then select cell B1, and drag the fill handle over to the range that you want to contain this formula, and all the non-blank cell values have been extracted. See screenshot:

doc-copy-only-nonblanks1

3. As they are formulas, when you copy them to other place, you should copy and paste them as values.

Note: This formula only be available for the constants, not applied to the formula cells.


arrow blue right bubble Copy and paste only non-blank cells with VBA code

If you are interested in VBA code, you can execute the following code to finish this task.

1. Hold down the ALT + F11 keys, and it opens the Microsoft Visual Basic for Applications window.

2. Click Insert > Module, and paste the following code in the Module Window.

VBA code: Copy and paste only non-blank cells in Excel

Sub PasteNotBlanks()
'Update 20140325
Dim rng As Range
Dim InputRng As Range, OutRng As Range
xTitleId = "KutoolsforExcel"
Set InputRng = Application.Selection
Set InputRng = Application.InputBox("Range :", xTitleId, InputRng.Address, Type:=8)
If InputRng.Columns.Count > 1 Then
    MsgBox "Please select one column."
    Exit Sub
End If
Set OutRng = Application.InputBox("Out put to (single cell):", xTitleId, Type:=8)
InputRng.SpecialCells(xlCellTypeConstants).Copy Destination:=OutRng.Range("A1")
End Sub

3. Then press F5 key to run this code, a prompt box will appear to remind you selecting the data range that you want to use. See screenshot:

doc-copy-only-nonblanks1

4. And then click OK, another prompt box will pop out to let you choose a cell to put the data.

doc-copy-only-nonblanks1

5. Click OK to finish this code, and only the non-blank cell values have been pasted into your specified position.

Note: This code is only available to the constants.


arrow blue right bubble Copy and paste only non-blank cells with Kutools for Excel

Is there any much easier way than above? Of course, Kutools for Excel's Select Nonblank Cells utility can help you select the nonblank cells first, and then copy and paste them.

Kutools for Excel, with more than 120 handy Excel functions, enhance your working efficiency and save your working time.

After free installing Kutools for Excel, please do as below:

1. Select the cell range, and click Kutools > Select > Select Nonblank Cells. See screenshot:
doc select nonblank cell 2

2. Then the nonblank cells are selected, press Ctrl + C to copy them, then go to select a cell where you want to output the paseted result, press Ctrl + V to paste selected nonblank cells. See screenshot:
doc select nonblank cell 3

arrow blue right bubble Copy and paste non-blank cell only



Kutools for Excel: 300 + functions you must have in Excel, 60-day free trial from here

Paste to Visible Range (copy and paste data in visible or filtered cells only.)

excel addin tool for paste data to filtered cells only and ignore hidden cells

Recommended Productivity Tools

Ribbon of Excel (with Kutools for Excel installed)

300+ Advanced Features Increase Your Productivity by 71%, and Help You To Stand Out From Crowd!

Would you like to complete your daily work quickly and perfectly? Kutools For Excel brings 300+ cool and powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) for 1500+ work scenarios, helps you solve 82% Excel problems.

  •  Deal with all complicated tasks in seconds, help to enhance your work ability, get success from the fierce competition, and never worry about being fired.
  •  Save a lot of work time, leave much time for you to love and care the family and enjoy a comfortable life now.
  •  Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands, and give you a healthy body.
  •  Become an Excel expert in 3 minutes, and get admiring glance from your colleagues or friends.
  •  No longer need to remember any painful formulas and VBA codes, have a relaxing and pleasant mind, give you a thrill you've never had before.
  •  Spend only $39, but worth than $4000 training of others. Being used by 110,000 elites and 300+ well-known companies.
  •  60-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years. Buy once, use forever.
  •  Change the way you work now, and give you a better life immediately!

Office Tab Brings Efficient And Handy Tabs to Office (include Excel), Just Like Chrome, Firefox, And New IE

  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Open and create documents in new tabs of same window, rather than in new windows.
  • Help you work faster and easily stand out from the crowd! One second to switch between dozens of open documents!
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Mickael · 2 years ago
    Thanks for the great tips!
    I am using the Find & Select feature, but it's taking a long time because my spreadsheet contains 70 columns and 450k rows. Is there a way to fasten the process?
  • To post as a guest, your comment is unpublished.
    Peter · 2 years ago
    When i select and copy only non-blank cells, how can i then paste it somewhere else with keeping the same empty ranges between them?
  • To post as a guest, your comment is unpublished.
    cvh · 3 years ago
    These tools delete the blank cells and compress the row. I want the format to be retained, including the spaces, but I do not want empty cells to overwrite cells containing existing data. i.e. I want to add the new, copied, cells in a column onto an existing column.
  • To post as a guest, your comment is unpublished.
    Quintin · 4 years ago
    Hi #abc

    I have used your formula =LOOKUP("zzzzz",CHOOSE({1,2},"",INDEX('List of Overdue items'!A:A,SMAL L(IF('List of Overdue items'!A$1:A$15 00"",ROW('List of Overdue items'!A$1:A$15 00)),ROWS('List of Overdue items'!B$1:B2)) )))

    I have data in one Worksheet and want to copy that data into another worksheet (same doc). Can you help?
  • To post as a guest, your comment is unpublished.
    Hellooo · 4 years ago
    Is there a way to make the macro work when referencing between different sheets?