Excel:在另一列中查找并删除列中的项目

huangapple go评论79阅读模式
英文:

Excel: Finding items in a column in another column and deleting them

问题

我正在尝试使用列在右侧(列H)的以下名称(Nancy、Daniel、Sergio、Patty)在左侧的表格中查找它们并删除它们(以及它们所在的整行)。

以下是已删除行的最终表格示例:

英文:

I'm trying to use the following names (Nancy, Daniel, Sergio, Patty) that are listed on the right-side column (column H) finding them on Table that is on the left-side and deleting them (along its whole row).

Excel:在另一列中查找并删除列中的项目

Here's how the final table would look like with the deleted rows:

Excel:在另一列中查找并删除列中的项目

Could this be done with a simple VLOOKUP formula?

答案1

得分: 1

如果你愿意只隐藏包含列表中姓名的行:

  1. 将当前数据格式化为表格(应该是CTRL+T)。
  2. 在表格中添加列‘Hide’。
  3. 在‘Hide’列中添加此公式:COUNTIF(H2:H5, A2)
  4. 确保公式正确定义整个列。
  5. 此列应该只包含‘1’和‘0’。将其筛选以仅显示‘0’,完成。
  6. 或者你可以筛选以仅显示‘1’,如果愿意,可以删除它们。
英文:

If you are okay with just hiding the rows which contains a name in the list:

  1. Format the current data as table (should be <kbd>CTRL</kbd>+<kbd>T</kbd>).
  2. Add column 'Hide' to the table.
  3. Add this formula in the 'Hide' column: COUNTIF(H2:H5, A2)
  4. Make sure the formula is correctly defined for the entire column.
  5. You should have only '1's and '0's in this column. Filter it to show only '0' and you are done.
  6. Or you can filter to show only the '1's and delete them if you wish that.

答案2

得分: 1

你不能使用公式删除行。要实现这一功能,你需要使用 VBA 代码。但是,使用 FILTER 公式,你可以创建一个新表,排除在 H 中的列表:

`=FILTER(A1:C7,ISNA(MATCH(A1:A7,H2:H4,0)))

结果:

Excel:在另一列中查找并删除列中的项目

英文:

You can't delete rows using formula. For doing that you would need VBA code. But with FILTER formula you could crate new table excluding list in H:

=FILTER(A1:C7,ISNA(MATCH(A1:A7,H2:H4,0)))

Result:

Excel:在另一列中查找并删除列中的项目

huangapple
  • 本文由 发表于 2023年3月12日 16:26:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/75711881.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定