简体   繁体   中英

Create dynamic cell block reference in excel formula

I am at a loss as to how to create a dynamic cell block reference in an Excel formula. As a simple example, if I have 5 id 's with scores per block and I needed to rank the scores within each block, what would be the easiest way to create formulas to do this? I am aware that you can create the formulas in the first 5 cells using relative references (ie =RANK.EQ(B#, B2:B6) ), copy those cells, and paste in the range that highlights the 15 cells.

在此处输入图片说明

If the blocks are 5 rows every time, then you can create ongoing 5-row-blocks in column B using INDEX the following way:

在此处输入图片说明

Formula in helper column F beginning in F2 downwards:

=2+INT((ROW(A1)-1)/5)*5

Formula in helper column G beginning in G2 downwards:

=2+4+INT((ROW(A1)-1)/5)*5

Formula in C2 downwards:

=RANK(B2,INDEX(B:B,F2):INDEX(B:B,G2))

Formula in D2 downwards (without helper columns):

=RANK(B2,INDEX(B:B,2+INT((ROW(A1)-1)/5)*5):INDEX(B:B,2+4+INT((ROW(A1)-1)/5)*5))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM