I have a big Dataset it is structured in such a way that always 16 rows belong to the same group. (e.g.: A1, A2, A3, A4, A5, A6, …A16 -> Group1; A17, A18, A19, A20,…,A32 -> Group2..etc.)

I would like to compare every Person of a group (e.g.: Group 1) with all the others of the same group (e.g.: Group 1) and retrieve the sum of each of the smaller number out of the two compared cells into another cell (without one’s owns comparison).

Herefore I have a formula that I came up with, which gives me the information I need & until here it works! The Formula I use in Excel is the following:

`=SUM(MIN(A1,A$1),MIN(A1,A$2),MIN(A1,A$3),MIN(A1,A$4),MIN(A1,A$5),MIN(A1,A$6),MIN(A1,A$7),MIN(A1,A$8),MIN(A1,A$9),MIN(A1,A$10),MIN(A1,A$11),MIN(A1,A$12),MIN(A1,A$13),MIN(A1,A$14),MIN(A1,A$15),MIN(A1,A$16))-A1`

But now the problem is that this formula works only for the first 16 rows (A1 - A16). Is there a possibility to make the formula change every 16. row?

Or how can I state the formula in such a way that when it reaches row A17 it references the now following 16 cells (A17 to A32) and not the previous 16 cells (A1 to A16)?

Doing it by hand is not an option in this case since I have thousands of data rows and the formula should switch its reference every 16. row of the dataset and refer to the 16 rows that belong to the same group.