=IF((B3+J3-L3)>P3,P3,IF((B3+J3-L3)<0,0,B3+J3-L3))
To generate Health For Next Round
=sum(iferror(INDEX(R1!G:G,MATCH(A5,R1!A:A,0),0),0),iferror(INDEX(R2!G:G,MATCH(A5,R2!A:A,0),0),0),iferror(INDEX(R3!G:G,MATCH(A5,R3!A:A,0),0),0),iferror(INDEX(R4!G:G,MATCH(A5,R4!A:A,0),0),0),iferror(INDEX(R5!G:G,MATCH(A5,R5!A:A,0),0),0),iferror(INDEX(R6!G:G,MATCH(A5,R6!A:A,0),0),0),iferror(INDEX(R7!G:G,MATCH(A5,R7!A:A,0),0),0),iferror(INDEX(R8!G:G,MATCH(A5,R8!A:A,0),0),0),iferror(INDEX(R9!G:G,MATCH(A5,R9!A:A,0),0),0),iferror(INDEX(R10!G:G,MATCH(A5,R10!A:A,0),0),0),iferror(INDEX(R11!G:G,MATCH(A5,R11!A:A,0),0),0),iferror(INDEX(R12!G:G,MATCH(A5,R12!A:A,0),0),0),iferror(INDEX(R13!G:G,MATCH(A5,R13!A:A,0),0),0),iferror(INDEX(R14!G:G,MATCH(A5,R14!A:A,0),0),0),iferror(INDEX(R15!G:G,MATCH(A5,R15!A:A,0),0),0),iferror(INDEX(R16!G:G,MATCH(A5,R16!A:A,0),0),0),iferror(INDEX(R17!G:G,MATCH(A5,R17!A:A,0),0),0),iferror(INDEX(R18!G:G,MATCH(A5,R18!A:A,0),0),0),iferror(INDEX(R19!G:G,MATCH(A5,R19!A:A,0),0),0),iferror(INDEX(R20!G:G,MATCH(A5,R20!A:A,0),0),0),iferror(INDEX(R1!H:H,MATCH(A5,R1!A:A,0),0),0),iferror(INDEX(R2!H:H,MATCH(A5,R2!A:A,0),0),0),iferror(INDEX(R3!H:H,MATCH(A5,R3!A:A,0),0),0),iferror(INDEX(R4!H:H,MATCH(A5,R4!A:A,0),0),0),iferror(INDEX(R5!H:H,MATCH(A5,R5!A:A,0),0),0),iferror(INDEX(R6!H:H,MATCH(A5,R6!A:A,0),0),0),iferror(INDEX(R7!H:H,MATCH(A5,R7!A:A,0),0),0),iferror(INDEX(R8!H:H,MATCH(A5,R8!A:A,0),0),0),iferror(INDEX(R9!H:H,MATCH(A5,R9!A:A,0),0),0),iferror(INDEX(R10!H:H,MATCH(A5,R10!A:A,0),0),0),iferror(INDEX(R11!H:H,MATCH(A5,R11!A:A,0),0),0),iferror(INDEX(R12!H:H,MATCH(A5,R12!A:A,0),0),0),iferror(INDEX(R13!H:H,MATCH(A5,R13!A:A,0),0),0),iferror(INDEX(R14!H:H,MATCH(A5,R14!A:A,0),0),0),iferror(INDEX(R15!H:H,MATCH(A5,R15!A:A,0),0),0),iferror(INDEX(R16!H:H,MATCH(A5,R16!A:A,0),0),0),iferror(INDEX(R17!H:H,MATCH(A5,R17!A:A,0),0),0),iferror(INDEX(R18!H:H,MATCH(A5,R18!A:A,0),0),0),iferror(INDEX(R19!H:H,MATCH(A5,R19!A:A,0),0),0))
To generate Total Damage Dealt Per Player
=if(or(iferror(INDEX(R1!$B:$B,MATCH($A5,R1!$A:$A,0),0),1)=0,iferror(INDEX(R2!$B:$B,MATCH($A5,R2!$A:$A,0),0),1)=0,iferror(INDEX(R3!$B:$B,MATCH($A5,R3!$A:$A,0),0),1)=0,iferror(INDEX(R4!$B:$B,MATCH($A5,R4!$A:$A,0),0),1)=0,iferror(INDEX(R5!$B:$B,MATCH($A5,R5!$A:$A,0),0),1)=0,iferror(INDEX(R6!$B:$B,MATCH($A5,R6!$A:$A,0),0),1)=0,iferror(INDEX(R7!$B:$B,MATCH($A5,R7!$A:$A,0),0),1)=0,iferror(INDEX(R8!$B:$B,MATCH($A5,R8!$A:$A,0),0),1)=0,iferror(INDEX(R9!$B:$B,MATCH($A5,R9!$A:$A,0),0),1)=0,iferror(INDEX(R10!$B:$B,MATCH($A5,R10!$A:$A,0),0),1)=0,iferror(INDEX(R11!$B:$B,MATCH($A5,R11!$A:$A,0),0),1)=0,iferror(INDEX(R12!$B:$B,MATCH($A5,R12!$A:$A,0),0),1)=0,iferror(INDEX(R13!$B:$B,MATCH($A5,R13!$A:$A,0),0),1)=0,iferror(INDEX(R14!$B:$B,MATCH($A5,R14!$A:$A,0),0),1)=0,iferror(INDEX(R15!$B:$B,MATCH($A5,R15!$A:$A,0),0),1)=0,iferror(INDEX(R16!$B:$B,MATCH($A5,R16!$A:$A,0),0),1)=0,iferror(INDEX(R17!$B:$B,MATCH($A5,R17!$A:$A,0),0),1)=0,iferror(INDEX(R18!$B:$B,MATCH($A5,R18!$A:$A,0),0),1)=0,iferror(INDEX(R19!$B:$B,MATCH($A5,R19!$A:$A,0),0),1)=0,iferror(INDEX(R20!$B:$B,MATCH($A5,R20!$A:$A,0),0),1)=0),"Y","N")
Check if a player has died
=if(or(iferror(search("swap",iferror(INDEX(R1!E:E,MATCH($A5,R1!$A:$A,0),0),1)),0),iferror(search("swap",iferror(INDEX(R2!E:E,MATCH($A5,R2!$A:$A,0),0),1)),0),iferror(search("swap",iferror(INDEX(R3!E:E,MATCH($A5,R3!$A:$A,0),0),1)),0),iferror(search("swap",iferror(INDEX(R4!E:E,MATCH($A5,R4!$A:$A,0),0),1)),0),iferror(search("swap",iferror(INDEX(R5!E:E,MATCH($A5,R5!$A:$A,0),0),1)),0),iferror(search("swap",iferror(INDEX(R6!E:E,MATCH($A5,R6!$A:$A,0),0),1)),0),iferror(search("swap",iferror(INDEX(R7!E:E,MATCH($A5,R7!$A:$A,0),0),1)),0),iferror(search("swap",iferror(INDEX(R8!E:E,MATCH($A5,R8!$A:$A,0),0),1)),0),iferror(search("swap",iferror(INDEX(R9!E:E,MATCH($A5,R9!$A:$A,0),0),1)),0),iferror(search("swap",iferror(INDEX(R10!E:E,MATCH($A5,R10!$A:$A,0),0),1)),0),iferror(search("swap",iferror(INDEX(R11!E:E,MATCH($A5,R11!$A:$A,0),0),1)),0),iferror(search("swap",iferror(INDEX(R12!E:E,MATCH($A5,R12!$A:$A,0),0),1)),0),iferror(search("swap",iferror(INDEX(R13!E:E,MATCH($A5,R13!$A:$A,0),0),1)),0),iferror(search("swap",iferror(INDEX(R14!E:E,MATCH($A5,R14!$A:$A,0),0),1)),0),iferror(search("swap",iferror(INDEX(R15!E:E,MATCH($A5,R15!$A:$A,0),0),1)),0),iferror(search("swap",iferror(INDEX(R16!E:E,MATCH($A5,R16!$A:$A,0),0),1)),0),iferror(search("swap",iferror(INDEX(R17!E:E,MATCH($A5,R17!$A:$A,0),0),1)),0),iferror(search("swap",iferror(INDEX(R18!E:E,MATCH($A5,R18!$A:$A,0),0),1)),0),iferror(search("swap",iferror(INDEX(R19!E:E,MATCH($A5,R19!$A:$A,0),0),1)),0),iferror(search("swap",iferror(INDEX(R20!E:E,MATCH($A5,R20!$A:$A,0),0),1)),0)),"Y","N")
Check if a player changed their element at any point