top 5 highest only specific rows

2019-08-29 05:46发布

I have this in my column A and column B is the number after the text.

Access rights   
Question    2
Total - Access rights   2
Adobe software  
Error   1
Total - Adobe software  1
Autorisaties    
Question    1
Total - Autorisaties    1
AX  
Question    13
Error   14
Total - AX  27
Backup  
Question    1
Total - Backup  1
Computer    
Question    4
Error   6
Total - Computer    10

Right now I have this formula:

=INDEX($A$2:$A28;MATCH(1;INDEX(($B$2:$B$28=LARGE($B$2:$B$28;ROWS(D$1:D1)))*(COUNTIF(D$1:D1;$A$2:$A$28)=0););0))

to get the largest value. So in this case the first line is Total AX. And when I drag that formula down it says error because that is the 2nd largest number.

What I want is that it look looks at the total - value so in this case it should first by Total -AX and then Total -computer and then total access rights and than the rest because some of them are showing 1 as total

1条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-08-29 06:00

To give you an idea:

enter image description here

Formula in E1:

=INDEX($A$1:$A$10,MATCH(LARGE((ISNUMBER(SEARCH("Total - ",$A$1:$A$10))*($B$1:$B$10)),ROW()),$B$1:$B$10,0))

Enter through CtrlShiftEnter

Drag down....

EDIT

In case you have duplicates, an helper column would be advisable IMO. Like so:

enter image description here

Formula in E1:

=LARGE((ISNUMBER(SEARCH("Total - ",$A$1:$A$10))*($B$1:$B$10)),ROW())

Formula in F1:

=INDEX($A$1:$A$10,SMALL(IF(E1=$B$1:$B$10,ROW($A$1:$A$10)-ROW($A$1)+1),COUNTIF($E$1:E1,E1)))

Both being array formulas entered through CtrlShiftEnter

查看更多
登录 后发表回答