There's no clean way to represent that chart as a formula, you won't be able to automate that easily. The easy way is this (I'm assuming you're using the R20 5e sheet): &{template:npcaction} {{rname=Swarm Attack}} [[@{target|foe|ac}-{@{selected|repeating_npcaction_$0_attack_tohit},@{selected|repeating_npcaction_$1_attack_tohit}}k1]]mob {{description=Swarm: @{selected|token_name} Target: @{target|foe|token_name} Roll required: [[@{target|foe|ac}-{@{selected|repeating_npcaction_$0_attack_tohit},@{selected|repeating_npcaction_$1_attack_tohit}}k1]] Attackers in swarm: [[?{Swarm size|3}]] [img](<a href="https://s3.amazonaws.com/files.d20.io/images/172431902/_3LACL6wBlv7INroLwe4fA/original.jpg" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/172431902/_3LACL6wBlv7INroLwe4fA/original.jpg</a>)}} &{noerror} Then do the calculation manually. Or you could put another line in there with a button link to another macro to enter the needed numbers: [Calculate result](~macros|mobCalc), and the mobCalc would just be: [[floor(?{Number of Attackers}/ ?{Attackers required per hit?|0} )]] attacks hit. or you could use the second macro to actually calculate damage, of course. There is a method to look up the Attackers required per hit, it's a lot of work. You would need to set up 20 roll tables, named 1mob to 20mob, each with the single "Attackers needed" value for that roll, e.g. 15mob would have a single entry: 4, 20mob would contain 20, and so on. You could then change the main macro to something like this: &{template:npcaction} {{rname=Swarm Attack}} [[floor(?{Number of attackers?|5}/[[1t[[[@{target|foe|ac}-{@{selected|repeating_npcaction_$0_attack_tohit},@{selected|repeating_npcaction_$1_attack_tohit}}k1]]mob] ]]) +1d0cs0cf0]] {{description=Swarm: @{selected|token_name} Target: @{target|foe|token_name} Roll required: $[[0]] Attackers in swarm: ?{Number of attackers?} Attackers required per hit: $[[1]] Attacks landed: $[[2]] [Calculate result](~macros|mobCalc)}} &{noerror} And something along these lines for damage: &{template:npcdmg}{{dmg1flag=1}}{{dmg1=[[{[[0@{selected|repeating_npcaction_$0_attack_damage}]],[[0@{selected|repeating_npcaction_$1_attack_damage}]]}k1*?{Number of hits?|1}]]}} {{dmg1type=from ?{Number of hits?} attacks}}&{noerror} Resulting in: