Create a smaller list from data in a larger list [

2019-08-21 17:20发布

I need some help in creating a list using information that is contained in a larger list in Excel. For instance, in cells A1:A15 I have a persons name. In cells B1:B15 I have a drop down box indicating Pass/Fail. I am only interested in the people who have failed, so is there a way to create a smaller list that will contain their name based on if they have the Fail designation in cells B1:15? Thanks in advance for any help.

2条回答
男人必须洒脱
2楼-- · 2019-08-21 17:59

Use this formula, say in E2:

=INDEX($A$1:$A$15,SMALL(IF($B$1:$B$15="Fail",ROW($B$1:$B$15)),ROW()-ROW($E$2)+1))

press CTRL+SHIFT+ENTER to evaluate it and drag it down.

enter image description here

Another way would be to filter column B for Fail values and copy only visible rows

查看更多
淡お忘
3楼-- · 2019-08-21 18:10

Try this small macro:

Sub SmallerList()
    K = 1
    For Each r In Range("B1:B15")
        If r.Value = "Fail" Then
            Range("C" & K).Value = r.Offset(0, -1).Value
            K = K + 1
        End If
    Next r
End Sub
查看更多
登录 后发表回答