tob*_*b88 74 excel excel-formula excel-2010
我有一列值通常显示为重复.我需要创建一个基于第一列的唯一值的新列,如下所示:
Column A Column B
a a
a b
b c
c
c
Run Code Online (Sandbox Code Playgroud)
这个B列实际上需要出现在同一工作簿中的不同工作表上,所以我认为它需要使用sheet2!A1样式格式.
我没有运气数据/过滤器菜单选项,因为这似乎只适用于命令.每当在A列中输入新值时,我都需要B列自动更新.
ach*_*dhr 64
托特罗的回答是正确的.该链接也非常有用.
基本上你需要的公式是:
B2=INDEX($A$2:$A$20, MATCH(0, COUNTIF($B$1:B1, $A$2:$A$20), 0))
Run Code Online (Sandbox Code Playgroud)
然后按ctrl+ shift+ enter(或使用数组公式无效).
这里要记住两件重要的事情:完整列表在单元格中A2:A20,然后必须将此公式粘贴到单元格中B2(不会B1因为这将给出循环引用).其次这是一个数组公式,所以你需要按ctrl+ shift+ enter,否则它将无法正常工作.
Tot*_*ero 21
这里有一个很好的指导如何做到这一点.
基本上类似于:
=INDEX(Sheet1!$A$1:$A$20, MATCH(0, COUNTIF($B$1:B1,Sheet!$A$1:$A$20), 0))
Run Code Online (Sandbox Code Playgroud)
小智 10
在我的情况下,当使用公式时,excel被冻结
B2 = INDEX($ A $ 2:$ A $ 20,MATCH(0,COUNTIF($ B $ 1:B1,$ A $ 2:$ A $ 20),0))
因为有很多行(10000).所以我用另一种方式做了,我将在下面展示.
我已将原始列表复制到第二列,然后使用Excel"删除重复项"功能,我可以找到唯一值列表.
从Microsoft Office网站复制:
Run Code Online (Sandbox Code Playgroud)Select all the rows, including the column headers, in the list你想过滤.
单击范围的左上角单元格,然后拖动到右下角的单元格.
Run Code Online (Sandbox Code Playgroud)On the Data menu, point to Filter, and then click Advanced Filter. In the Advanced Filter dialog box, click Filter the list, in place. Select the Unique records only check box, and then click OK.将显示已过滤的列表,并隐藏重复的行.
Run Code Online (Sandbox Code Playgroud)On the Edit menu, click Office Clipboard.将显示"剪贴板"任务窗格.
Run Code Online (Sandbox Code Playgroud)Make sure the filtered list is still selected, and then click Copy Copy button.已过滤的列表以边界轮廓突出显示,选择在剪贴板顶部显示为>>项目.
Run Code Online (Sandbox Code Playgroud)On the Data menu, point to Filter, and then click Show All.原始列表将重新显示.
Run Code Online (Sandbox Code Playgroud)Press the DELETE key.原始列表将被删除.
Run Code Online (Sandbox Code Playgroud)In the Clipboard, click on the filtered list item.已过滤的列表显示在与原始列表相同的位置.
来源:Microsoft Office网站(链接已删除,导致死机)
在排序列上,您还可以尝试这个想法:
B2=A2
B3=IFERROR(INDEX(A:A,MATCH(B2,A:A,1)+1),"")
Run Code Online (Sandbox Code Playgroud)
B3可以粘贴下来.在最后一次独特匹配之后,它将结果为0.如果这是不需要的,请放置一些IF语句以排除这种情况.
编辑:
比IF语句更容易,至少对于文本值:
B3=IFERROR(T(INDEX(A:A,MATCH(B2,A:A,1)+1)),"")
Run Code Online (Sandbox Code Playgroud)
从列中删除重复项
当列B仍处于选中状态时,在公式输入框中输入
=IF(TRIM(A1)=TRIM(A2),"",TRIM(A1))
Run Code Online (Sandbox Code Playgroud)当B列仍处于选中状态时,选择编辑 - >填充 - >向下(在较新版本中,只需选择单元格B1并向下拉外框以在列中向下展开)
注意:如果列B在另一张纸上,您可以执行Sheet1!A1和Sheet1!A2.