1
4

2 回答 2

3

A couple of suggestions:

  1. Using this array formula from Pearson - screenshot below
  2. A manual (non-VBA) SpecialCells method which is easier

SpecialCells method

  • copy the column with gaps to the right
  • select the new column, Press F5, Special and check blanks
  • right click, select Delete and then checlk shift cells up

The first two steps of this 3 step process (selecting the blanks) are shown here at Debra Dalgleish's site

Array Formula method

enter image description here

于 2012-08-17T02:48:44.737 回答
1

Give this a shot, entered as an array formula with Ctrl+Shift+Enter):

Quickly paste-able version (note: you will need to change these references to those in your sheet - I used data in A1:A7 in mine [see image]):

=IFERROR(INDEX($A$1:$A$7, SMALL(--(IF($A$1:$A$7<>"",ROW($A$1:$A$7),100000)),ROW())), "")

Longer-form (to better see what is going on):

=IFERROR(
        INDEX(
              $A$1:$A$7,
              SMALL(
                  --(IF($A$1:$A$7<>"",ROW($A$1:$A$7),100000)),ROW())),
   "")

Basically, we use an index formula on the column. The row argument uses the SMALL() formula to find all instances where the column contains empty values, and then assigns an arbitrarily high number that hopefully won't ever be matched (this may be bad practice :) ). The k argument to SMALL() (the kth element in the array you want to match) is just the row number, meaning that as you go down the list, you won't match items above the current one.

enter image description here

于 2012-08-17T03:24:04.877 回答