I am looking to make a function that finds if a name (string) is in a particular cell, and then add the cell 2 columns over every time that specific name is found.
I think im looking for a type of if statement that identifies if any of cells from x to y have a specific string, then adding all the cells 2 to the right of every time the string is identified.
Specifically, I am calculating run differential in a baseball stat keeping sheet. I currently have it set up so The columns of the game logs are as follows: WINNER, LOSER, RUN DIFFERENTIAL. I am looking to create a function which finds the run differential each time that specific team played.
Example: if Team A won by 9 in their first game, the name of their team would be in the WINNER column, followed by the team they beat in the LOSER column, and then finally followed by the RUN DIFFERENTIAL (+9) which shows how much Team A, the WINNER, beat TEAM B by, the loser.
I think the idea is to first locate where the team won and lost. A team’s name in the win column indicates a win and is easy to identify, so my initial idea was to give a simple if statement for wins (If name is found in this cell, ADD the run differential which is 2 rows over, meaning they won by that much) and then sum whatever that number comes to with all the times they’re found in the loser column and the run differential of all those times, which would be how much they’ve lost by.