Hello Prasanna,

I am assuming the rankings you mention are in lines 58 (best_idea_in_class) and 59 (second_best_idea_in_class).

In order to achive what you mention, I would create several variables with "calculate" **before** the end of the repeat group, where each team would have 2 variables named "first_TeamX" and "second_TeamX" (X being a letter from A to O for what I can see in your file; in total 30 variables (15x2)).

This would result in the following:

```
+-----------+--------------+---------------------------------------------------+
| type | name | calculation |
+-----------+--------------+---------------------------------------------------+
| calculate | first_TeamX | if(${best_idea_in_class}='Team_X','1','0') |
| calculate | second_TeamX | if(${second_best_idea_in_class}='Team_X','1','0') |
| calculate | first_TeamY | if(${best_idea_in_class}='Team_Y','1','0') |
| calculate | second_TeamY | if(${second_best_idea_in_class}='Team_Y','1','0') |
+-----------+--------------+---------------------------------------------------+
```

Then, **after** the end of the repeat you add this:

```
+-----------+------------------+------------------------------+
| type | name | calculation |
+-----------+------------------+------------------------------+
| calculate | all_first_TeamX | number(sum(${first_TeamX})) |
| calculate | all_second_TeamX | number(sum(${second_TeamX})) |
| calculate | all_first_TeamY | number(sum(${first_TeamY})) |
| calculate | all_second_TeamY | number(sum(${second_TeamY})) |
+-----------+------------------+------------------------------+
```

Here you can use a variable "note" to show the overall results for all teams and/or max() to know which is the maximum number of votes a single team received in each category.

The other alternative I can think about is using several if(), and I am not sure how a tie would be handled.

Hope it helps.