If I've understood what you need, here's code that should do what you need, set up for the additional repeating sections (some notes follow) const repeatingName = ( section , id , name ) => `repeating_ ${ section } _ ${ id } _ ${ name } ` ; [ "En" ]. forEach ( section => { const coeff = 1.15 ; on ( `change:niveau change:repeating_ ${ section . toLowerCase () } :pdv` , function () { getSectionIDs ( `repeating_ ${ section } ` , function ( idarray ) { const fieldNames = idarray . reduce (( all , one ) => [... all , repeatingName ( section , one , "pdv" )], []); getAttrs ([... fieldNames , "niveau" ], function ( values ) { const niveau = parseInt ( values . niveau ) || 0 ; const level_multiplier = Math . pow ( coeff , niveau - 1 ); const output = {}; idarray . forEach ( id => { const base_hp = parseInt ( values [ repeatingName ( section , id , "pdv" )]); output [ repeatingName ( section , id , "Pdvnv" )] = Math . round ( base_hp * level_multiplier ); }); setAttrs ( output ); }); }); }); on ( `change:niveau change:repeating_ ${ section . toLowerCase () } :deg change:repeating_ ${ section . toLowerCase () } :degmodif` , function () { getSectionIDs ( `repeating_ ${ section } ` , function ( idarray ) { const fieldNames = idarray . reduce (( all , one ) => [... all , repeatingName ( section , one , "deg" ), repeatingName ( section , one , "degmodif" )], []); getAttrs ([... fieldNames , "niveau" ], function ( values ) { const niveau = parseInt ( values . niveau ) || 0 ; const level_multiplier = Math . pow ( coeff , niveau - 1 ); const output = {}; idarray . forEach ( id => { const deg = parseInt ( values [ repeatingName ( section , id , "deg" )]); const degmodif = parseInt ( values [ repeatingName ( section , id , "degmodif" )]); const DegTot = ( deg * 10 + degmodif ) * level_multiplier ; const DegNv = Math . floor ( DegTot / 10 ); const DegModifNv = DegTot %= 10 ; output [ repeatingName ( section , id , "DegNv" )] = DegNv ; output [ repeatingName ( section , id , "DegModifNv" )] = DegModifNv ; }); setAttrs ( output ); }); }); }); }); This splits the work over two sheet workers in the interests of ease and modularity. The first worker calculates hp, the second the damage stuff, but the sheet workers use most of the same code. (So this could have been written more elegantly, but copy & paste exists, so...) This assumes you have changed the name nvgroupe to niveau, and changed it in the original sheet worker. Now if you have multiple sheet workers whose attributes are all the same and the only change is the repeating section, you only need to change one line: [ "En" ]. forEach ( section => { Just add the extra repeating sectiowns in there separated by comams, so if your had repeating_en, repeating_two, and repeating_three, you'd change that line to [ "En", "two ", "three" ]. forEach ( section => { That will handle all the repeating sections with no further changes needed.