I have a total (cost) figure and want to calculate an allocation of that figure to a (cost) category. A user can specify by input the allocation by % or by absolute value. If they enter absolute value, I calculate %. If they enter %, I calculate absolute value. What's the simplest way to achieve this? Many thanks in advance.

So Total Cost = £X
Category cost = Y% then Category cost, £Z = £X * Y%
or
Category cost = £Z then Category cost Y% = 100 * £Z / £X