# Friendly Team vs. Enemy attack math and complicated functions in Google Sheets

If Friendly Team Hero Power P2,P4,P6,p8 etc. is greater then Enemy Team Power "T2:T15" Else Don't match it and instead look for titan, Same thing P3,P5,P7etc... Is greater then T16:T31 Now give results. In q. Each line should have a match.

Now once we have the 4 Parts:

Part 1: P2 The Friendly Hero
Part 2: P3 Friendly Titan
Part 1: P4 The Friendly Hero
Part 2 P5 Friendly Titan and so on
Part 3: T2:T15 Enemy Hero
Part 4: T16:T31 Enemy Titan

Lets give results in p2:p31 A player has 2 Attempt attacks They can choice to battle 2 titan teams or 2 hero teams if they want. The point of this is every player should have a better advantage of the enemy if they need to do 2 titans, 2 heroes or 1 and 1.

(Click image to enlarge)

If I need to work on a JavaScript code then point me in the right direction.

To create a custom function use Google Apps Script. This is very similar to writing a JavaScript function.

``````/**
* If the arguments are numbers, the sum of will be returned
* If one of arguments are strings, they will be concatenated
*
* @customfunction
*/
function myCustomFunction(a,b){
return  a + b;
}
``````