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

microsoft excelmicrosoft-excel-2016

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.

Best Answer

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"