Hi @LucieRipova ,
I did a simple test for you.
1\ This is my table 'Table1' in excel.

2\ Add 4 gallery control 'Gallery1', 'Gallery1_1', 'Gallery1_2' and 'Gallery1_3'.
Set their Items property to:
'Gallery1' Items:
Table1.Test1
'Gallery1_1' Items:
Table1.Test2
'Gallery1_2' Items:
Table1.Test3
'Gallery1_3' Items:
Table1.Test4
Insert 4 Textinput control into the 4 gallery control 'TextInput1' ,'TextInput1_1' , 'TextInput1_2' and 'TextInput1_3'.
Set theri Default property to:
ThisItem.Test1
ThisItem.Test2
ThisItem.Test3
ThisItem.Test4
3\ Add the 5th gallery control 'Gallery1_4' and set its Items property to:
Sequence(CountRows(Gallery1.AllItems))
Insert a label control and set its Text property to:
Sum(Last(FirstN(Gallery1.AllItems,ThisItem.Value)).TextInput1.Text,Last(FirstN(Gallery1_1.AllItems,ThisItem.Value)).TextInput1_1.Text,Last(FirstN(Gallery1_2.AllItems,ThisItem.Value)).TextInput1_2.Text,Last(FirstN(Gallery1_3.AllItems,ThisItem.Value)).TextInput1_3.Text)
4\ The result is as follows:

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.