excel VB script

Job ID: 35957999

Budget: $10 – $30 USD

I have an excel sheet with a list of soccer matches played in Italy.
I need a VB function that for each row calculates:
- sum of goals scored by the team playing at home in the previous 3 last home games
- sum of goals conceded by the home team in the previous 3 last home games
- sum of goals scored by the away team in the previous 3 last games played away
- sum of goals conceded by the away team in the previous 3 last games played away
Keep in mind that:
- previous matches do not have a precise alternation
- in case you are at the beginning of the league and therefore for the first games the function will have to add up the goals of the games played up to that moment even if the games played at home or away from home are less than 3
For better understanding, please take a look at the attached excel file, what is expected for example for the match at row #83
Related categories: Visual Basic Excel VB.NET