[英]Multiple criteria unique values
因此,我了解您已经解决了第二个问题。 至于动态列表,我相信最快的方法是使用宏。 如果要将唯一的ID列表放置在Sheet3中,它将看起来像这样:
Sub list()
Dim pet, toy, animal As String
Dim ID, row As Integer
'pointing where list of unique ids will begin
Sheets("Sheet3").Activate
Range("A2").Select
'pointing beginig of the table with data
Sheets("Sheet2").Activate
Range("A2").Select
'loop to look for the ids
Do While IsEmpty(ActiveCell) = False
pet = ActiveCell.Value
ID = ActiveCell.Offset(0, 2).Value
toy = ActiveCell.Offset(0, 8).Value
animal = ActiveCell.Offset(0, 9).Value
If ((pet <> "dog") And (toy = "ball") And (animal = "horse")) Then
Sheets("Sheet3").Activate
ActiveCell.Value = ID
ActiveCell.Offset(1, 0).Select
Sheets("Sheet2").Activate
End If
ActiveCell.Offset(1, 0).Select
Loop
'removing duplicates from our list
Sheets("Sheet3").Activate
row = ActiveCell.row
ActiveSheet.Range("$A$2:$A$" & row).RemoveDuplicates Columns:=1, Header:=xlNo
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.