【问题标题】:Find Missing Data in Excel Column在 Excel 列中查找缺失数据
【发布时间】:2013-01-04 18:30:19
【问题描述】:

我正在使用 Excel 2003 并尝试比较两列以查找一列中不存在于另一列中的数据。

例如:

【问题讨论】:

标签: excel compare


【解决方案1】:

在 VBA 中,您可以尝试以下丑陋但有效的代码:

Sub missing()

Dim ya As Long, yb As Long, yc As Long, alast As Long, blast As Long
Dim flag As Boolean

yc = 2
yb = 2
flag = 0
alast = Range("A65536").End(xlUp).Row
blast = Range("B65536").End(xlUp).Row

For ya = 2 To alast
flag = 0

Do While yb <= blast
    If Range("A" & ya) = Range("B" & yb) Then flag = 1
    yb = yb + 1
    Loop

    If flag = 0 Then
        Range("C" & yc) = Range("A" & ya)
        yc = yc + 1
    End If

    yb = 2

Next ya

End Sub

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-08
    • 1970-01-01
    • 1970-01-01
    • 2011-11-11
    • 2017-01-31
    相关资源
    最近更新 更多