Top 5 using range in column A that matches values range of column B

前端 未结 2 339
醉话见心
醉话见心 2021-01-17 05:33
[A]  [B]  [C]  [D]  [E]
ABC  DFC  20
DE   DE   12
     GF   11
     ABC  19
     DE   17
     DE   15
     XE   14
     ABC  10

I would like to put

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-17 06:34

    In cell E1 and copied down:

    =IF(ROW(E1)>SUMPRODUCT(COUNTIF($B$1:$B$8,$A$1:$A$6)),"",LARGE(INDEX((COUNTIF($A$1:$A$6,$B$1:$B$8)>0)*$C$1:$C$8,),ROW(E1)))
    

    In cell D1 and copied down:

    =IF(E1="","",INDEX($B$1:$B$8,MATCH(E1,$C$1:$C$8,0)))
    

    Both formulas are regular formulas and do not require array entry. In both cases, adjust the B and C column references to fit your actual data. Don't use whole column references. If necessary, use dynamic named ranges for the column B and C range references

    EDIT: And just in case there are duplicates in the numeric values of the top five numbers for column C, use this formula instead in cell D1 and copy down:

    =IF(E1="","",INDEX($B$1:$B$8,SMALL(INDEX(($C$1:$C$8=E1)*ROW($C$1:$C$8),),COUNTIF($C$1:$C$8,"<>"&E1)+COUNTIF(E$1:E1,E1))))
    

提交回复
热议问题