Excel bug? Inconsistent behavior when Cut/Copy-Pasting across filtered data

4

Problem

I'm seeing the following inconsistent behavior in Excel 2016, when Copying/Cutting/Deleting data across filtered data:

  1. Copying Cells: Data gets "copied" from the visible cells only, and not from the filtered cells.
  2. Cutting Cells: Data gets "cut" from both - the visible, as well as the filtered cells.
  3. Pasting Cells: Data gets pasted on to both - the visible, as well as the filtered cells.
  4. Formatting/Deleting/Dragging Down/Other: Only the visible cells get affected, and not the filtered cells.

I see no good reason for this inconsistent behavior - is this a bug? Or is there some reason for this?

And more importantly, is there any way to get Excel to ignore hidden rows when Cutting and Pasting data, so that it is more consistent with the rest of the operations?

Demo

To try this out, please create the following table in Excel:

enter image description here

Next, filter out the rows with the Category = "Hide":

enter image description here

You should see something like:

enter image description here

Now, do the following:

  1. Select the visible cells in the Copy-From column (AAAA, BBBB, EEEE, FFFF), and Copy them (CTRL-C on Windows)
  2. Go to the first empty cell under Copy-To, and Paste (CTRL-V on Windows)
  3. Select the visible cells in the Cut-From column (GGGG, HHHH, KKKK, LLLL), and Cut them (CTRL-X on Windows)
  4. Go to the first empty cell under Cut-To, and Paste (CTRL-V on Windows)
  5. Select the visible cells in the Format column (MMMM, NNNN, QQQQ, RRRR), and make them Bold (CTRL-B on Windows)
  6. Select the visible cells in the Delete column (SSSS, TTTT, WWWW, XXXX), and Delete them (DEL on Windows)
  7. Select the first cell in the Drag column (January), and drag it down till the end of the column (till CCCC).

You should now see:

enter image description here

Now, clear the filter from the Category column, and you should see:

enter image description here

Based on the above, we can see several inconsistencies in how the filtered cells are handled:

  • Copy: ignores filtered cells
  • Cut: operates on filtered cells
  • Paste: operates on filtered cells
  • Delete: ignores filtered cells
  • Formatting: ignores filtered cells
  • Dragging data down: ignores filtered cells

Bonus

This behavior for filtered cells is different from how hidden cells are handled (to hide a cell, right click on the column or row header, and choose Hide - this will hide the entire row or column). Hidden rows are included in all operations - that is, we can Copy, Cut, Paste, Delete, Format etc data if it is Hidden. The operations seem to behave inconsistently only for "Filtered" data.

Also, interestingly, when the data is hidden and not filtered, the Drag operation behaves differently as well - instead of repeating "January" everywhere, it behaves more intelligently, and shows February, March etc.

Omaer

Posted 2017-05-29T11:37:48.113

Reputation: 141

This is a happy case. The inconsistencies I encounter have absolutely no logic. I never determined why if you cut-paste a cell sometimes the cell borders are also moved and sometimes not. Seems totally random. – Overmind – 2017-05-29T12:34:11.417

I've always used excel more for viewing/analyzing information. Recently, I had to modify some attributes for a list of 190,000 entities - and after several weeks of working on it, when we finalized the list, I realized that something fishy was going on - and now I have to verify all 190,000 entities all over again! Luckily I haven't noticed too much random behavior at my end - but I'm starting to trust Excel a little less now. – Omaer – 2017-05-29T12:43:55.707

In a scenario like that I'd rather do some direct XML checks. It may be easier in some cases, but that needs some familiarity with XML. Anyway, the 'only copy visible cells' it's an option in Home > Find & Select -> Go To Special. Make sure it's not active. It should not be active by default. That may be the cause of point #1 in your list. – Overmind – 2017-05-29T12:55:27.290

Paste has to be to a contiguous range. The cell "row" is not part of the copied data. Also, at least in 2016, the Cut operation has to be on a contiguous range. It is not possible to select only the visible cells, and perform a Cut. Perhaps you selected the entire column, thinking that you only selected the visible cells? Copy will exclude filtered cells, but not hidden cells. If you want to exclude hidden cells, you have to actually select just the visible cells as outlined in Help for the Copy function. – Ron Rosenfeld – 2017-05-29T19:36:48.053

Answers

0

I'm going to try and answer this question in parts.

For your cell formatting: What gets moved is the formatting on the CELL, not what it looks like. Let's take cells A1 and B1. They're next to each other. There's a border between the two. I'm going to move cell B1.

If the border is because B1 has a left border, it'll move.

If the border is because A1 has a right border, it won't move.

I never use cut, because it ISN'T copy-paste-delete. Cut is treated as a "special" action, and as a result, it ignores filters. It will also move cell references with it, and overwrite cell references where it lands. If you try similar experiments with paste special data into filtered ranges, or if your drag-down is copy then paste special, you might see similar behavior.

I've had quite a few problems at work from people cutting and pasting data. My mantra is "Never cut and paste - you won't get the results you're hoping for"

Selkie

Posted 2017-05-29T11:37:48.113

Reputation: 429

0

I tried exactly what you said on the most recent Excel version on Android in google play store.

Results were consistent. After unfiltering, all copy and cuts were pasted. All bolds were bold. All deletes, I don't believe you can delete on my version, I used clear, it all got cleared. Dragging - can't drag on my version, used fill. Filled January, February...to June. It filled correctly.

Seems your version does have issues.

David J

Posted 2017-05-29T11:37:48.113

Reputation: 11