lundi 22 février 2021

If-statement on multiple conditions [closed]

I am trying to do the following: If the Year equals 1990 and 2005, we substract the Values for Cost X of Model 1 so it will be 100-400=-300. If the Year equals 1990 and 2005, we substract the Values for Capacity X of Model 1 so we get 32-29. Then, we divide the results: -300/4. (The numbers are not the right one, so this is normal.)

I am trying to make the formula as easy as possible because I have different models (e.g., 1,2,3,4,5,6,7,8) while Cost could be either X, Y, Z. I also have various Country (almost all countries covered and WORLD represents just the average of countries). I would need to calculate what I described above for each different countries based on the different model and cost/capacity (X,Y,Z).

Country Source  Model   Description     Year    Numbers
0       WORLD   A   1   Cost X          1990    100
1       WORLD   A   2   Cost X          1995    200
2       WORLD   A   3   Cost X          2000    300
3       WORLD   A   1   Cost X          2005    400
4       WORLD   A   1   Cost Y          1990    500
5       WORLD   A   1   Cost Y          2005    400
12995   WORLD   A   1   Capacity X      1990    29
12996   WORLD   A   2   Capacity X      1995    30
12997   WORLD   A   3   Capacity X      2000    31
12998   WORLD   A   1   Capacity X      2005    32
12999   WORLD   A   1   Capacity Y      1990    33
13000   WORLD   A   1   Capacity Y      2005    45

Aucun commentaire:

Enregistrer un commentaire