Your "x" are in cells K5 to O5 (five cells)
Your percentages are in cells U5 to Z5 (six cells)
I supposed that your percentages are in cells
U5 to Y5 and not in cells U5 to Z5.
The formula is (I guess)
=IF(COUNTIF(K5:O5,"x")=1,(J5+I5*SUMPRODUCT( (K5:O5="x")*(U5:Y5))) *
(IF(P5="x",0.95,1)),"no percentage ")
-----------------------------------------------------------------
if COUNTIF(K5:O5),"x")=1 then we calculate your formula otherwise we return
the string "no percentage"
(we suppose that one and only one "x" must be present )
your formula:
sumproduct returns the product (term by term) of the two arrays:
(K5:O5="x") and (U5:Y5)
for instance if M5 is "x" then
the first array is {K5="x",L5="x",M5="x",N5="x",O5="x"}
= {false,false,true,false,false}
and the second array is {rateU5,rateV5,rateW5,rateX5,rateY5}
the sumproduct is :
sum({false,false,true,false,false}* {rateU5,rateV5,rateW5,rateX5,rateZ5})
then sum({0,0,rateW5,0,0}) = rateW5
-false is converted to 0 when multiplied with a number-
-true is converted to 1 when multiplied with a number-
Then rateW5 is multiplied by I5
then we add J5
and then we multiply with the result of:
IF(P5="x",0.95,1)
hope it will help you.