【问题标题】:How can I look for the duplicate values in a certain field in a spreadsheet?如何在电子表格的某个字段中查找重复值?
【发布时间】:2011-01-11 10:12:41
【问题描述】:

我有一个 Excel 文件,想在某个字段(例如电子邮件帐户列表)中查找重复值。就像使它们的格式相同或类似。

怎么做?

【问题讨论】:

  • 这可能属于超级用户,但我不确定。

标签: excel duplicates


【解决方案1】:

您可以通过创建包含公式的另一列(假设您正在检查列QCOUNTIF(Q:Q, Q2) 来查找列中的重复项。

然后您可以使用条件格式突出显示新列值为> 1 的行。

【讨论】:

    【解决方案2】:

    使用 Excel 2007 版时,可使用内置功能来删除重复项。

    该命令位于数据选项卡上,一组数据工具;
    图标删除重复项。


    或者使用宏。通过标签标记重复值,例如相邻列的 X。 接下来,它们可以被自动过滤器使用,过滤掉标记的行和键盘快捷键 CTRL + -(减号)可以一次删除重复项。

    Option Explicit
    'crea by pc-prog.eu
    
    Sub SelectRowOfDupli_A()
    Dim x As Variant, xRng As Range, xR As Range
    Dim xMltRow As String, i As Integer, xObl As String
    Set xRng = Selection
    x = "xxxxxx"
    
    On Error GoTo xErr
    xObl = "B"
    xObl = InputBox("Enter COLUMN where by 'X' sign will be marked duplicate entries " & _
    "of selected cells:", "RANGE", xObl)
    
    If xObl = "" Then
    MsgBox "Column name must be entered!", vbCritical, "CHYBA"
    Else
    For Each xR In xRng
    If Trim(CStr(xR.Value)) = x Then
    Range(xObl & CStr(xR.Row)).Value = "X"
    i = i + 1
    Else
    x = Trim(CStr(xR.Value)) 'xR.Value
    End If
    Next xR
    If xMltRow <> "" Then
    Range(xMltRow).Select
    End If
    MsgBox "Done. " & CStr(i) & " duplicates."
    End If
    Exit Sub
    xErr:
    MsgBox Err.Description, vbCritical, "FINISHED WITH ERRORS:"
    End Sub
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-10-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-14
      相关资源
      最近更新 更多