Using Variables

I'm trying to not use 16 nested ifElse statements

I have created 8 fields all with the same name format $pX_haz_premium_c X being 1 to 8. Each performs a similar calculation based on which p number has been selected from a drop down list. I need to show only the calculation for the selected p number i.e. p3.

I have another field called $field_name_c this has a simple formula to create the correct calculation to choose concat($bi_program_no_c,"_haz_premium_c") this would create if p3_haz_premium_c p3 were chosen etc.

I then have a third field that contains ;

ifElse(equal($policy_status_c,"Cancelled"),"0.00", $field_name_c)

At the moment $field_name_c displays the text "p3_haz_premium_c" instead of the value calculated by the p3_haz_premium_c field

How can I display the correct calculated value?