Extracting all rows based on a value of cell without VBA

前端 未结 4 1868

I\'m really struggling to find an answer to this as online I\'ve really only found VBA solutions to this problem which isn\'t what I wish to learn how to do.

4条回答
  •  抹茶落季
    2020-12-30 14:33

    Here is a solution with array formulas. It will calculate extremely slowly, and honestly VBA is a much better solution. You will need to tell excel these are array formulas by hitting "Ctrl + Shift + Enter" after inputting the formulas, this will add the {} around the equation. Finally, drag down the array formulas to see the first "X" results with blood type "O":

    First cell formula for "Blood" --> assumes blood is in column A of sheet1 {=IFERROR(INDEX(Sheet1!$A:$D,SMALL(IF(Sheet1!$A:$A="O",ROW(Sheet1!$A:$A)),ROW(1:1)),1,1),"")}

    First cell formula for "Name" --> assumes name is in column B of sheet1 {=IFERROR(INDEX(Sheet1!$A:$D,SMALL(IF(Sheet1!$A:$A="O",ROW(Sheet1!$A:$A)),ROW(1:1)),2,1),"")}

    First cell formula for "Age" --> assumes age is in column c of sheet1 {=IFERROR(INDEX(Sheet1!$A:$D,SMALL(IF(Sheet1!$A:$A="O",ROW(Sheet1!$A:$A)),ROW(1:1)),3,1),"")}

    First cell formula for "Gender" --> assumes gender is in column d of sheet1 {=IFERROR(INDEX(Sheet1!$A:$D,SMALL(IF(Sheet1!$A:$A="O",ROW(Sheet1!$A:$A)),ROW(1:1)),4,1),"")}

    Results:

    BLOOD   NAME    AGE GENDER
    O       Lucy    32  Female
    O       John    11  Male
    O       Amy     23  Female
    O       Linda   11  Female
    

提交回复
热议问题