I need an excel formula (possibly two formulas) that calculates the following scenario. The only way I have been able to achieve a result so far is by using mental trial and error - I would like to automate the process if possible.
It involves 2 starting values which will be the inputs:
Starting Value 1: 30
Starting Value 2: 24

Those values are then added (24+30=54) to generate the MAX value. In this case 54.

I then must transform these values using a ratio which will also be an input.
In this case lets assume a ratio of 2:1 where:

Ending Value 1 = 2x ending value 2
Ending Value 2 = 1/2 ending value 1

...and the sum of ending value 1 & 2 = Max value (54)

In this case the solution is:
Ending Value 1: 36
Ending Value 2: 18

I figured this out simply using trial and error and I would ultimately like to automate the process so that no matter what the inputs (starting values and the ratio) are, it will calculate the ending values.

Any help either in excel or just mathematically would be great! Thank you!