Forum Discussion

lucioxiii's avatar
lucioxiii
Copper Contributor
Oct 27, 2021

Pivot table - Use count function based on Ranking

Hi,

 

Is there a way in pivot table based on the ranking values to count the number of times an item has appeared in the top 5 for last 4 weeks?

 

I am trying to achieve the far right column below in excel pivot table. Is this possible?

 

 Week 1Rank for Week 1Week2Rank in Week 2Week3Rank in Week 3Week4Rank in Week 4Times appeared in top 5 in 4 weeks
Item 188196327656949131
Item 255683264464775561
Item 3357583910394683680
Item 440362713214387992
Item 589110919771068942
Item 61563102373582672
Item 712223365335420013
Item 820947649110221423
Item 94607655876173051
Item 10117144265788936101

 

Thanks in advance

4 Replies

  • SergeiBaklan's avatar
    SergeiBaklan
    Diamond Contributor

    lucioxiii 

    Perhaps I misunderstood. We speak about structured table or about PivotTable ? If PivotTable what is the source for it?

    For the structured table it could be like

    =LET(
      large5, LARGE([Rank for Week 1], SEQUENCE(5)),
      ranks,  INDEX( Table1, ROW() - ROW(Table1[#Headers]), {3,5,7,9}),
      SUM( IF( ISNA( XMATCH(ranks, large5) ), 0, 1)) )

    but that doesn't meet your manually added column. Perhaps you may give bit more details.

    • lucioxiii's avatar
      lucioxiii
      Copper Contributor

      SergeiBaklan 

       

      I am working in a pivot table. So using the Pivot table ranking feature (as explained in this https://tanducits.com/tips-and-tricks/adding-rank-in-pivot-tables-in-excel#1 for 2010 versions and above). The pivot table sources is a table within the workbook.

       

      Hope this is the information you were after.

Resources