Update column based on criteria in row

Thank you guys for your replies. As an complete newbie I do not follow your answer. I've tried different queries,to no avial. Please be patient with me. I think best to explain myself is with to images. Hope it helps to explain myself.

Before the update of the table (called Data) the table looks like this

After the update the table would look like this

The last column (gem) is calculated by sum in the ton column divide by the sum of the opp column where the kult and klas in the two columns are the same as for the specific row.

The following excel formula does the trick =(SUMIFS(ton,kult,D3,klas,E3))/(SUMIFS(opp,kult,D3,klas,E3))
where D3 is the kult field in the row and E4 is the klas field in the row.

I hope referring to Excel is not too simple, but I do not know how to express myself better.

Thank you and regards.