Excel – calculate based on multiple criteria across multiple columns

microsoft excel

I have a sheet for data entry called 'Data'. Entered data are sex, age and a score. In another worksheet "FACTG_Ref" that works as a reference/lookup include sex, age1, age2, left and right. age1 and age2 works as range for age group. left and right work as range for score.

Data

FACTG_Ref

I need to calculate column "BELOW', "BETWEEN" and "ABOVE" in sheet 'Data', based on sex values in sheet 'Data' matching sex in 'FACTG_Ref', age values in the right age range (between age1 and age2 in FACTG_Ref). If age is under 18, leave all calculation blank. Then if score is below left, then BELOW = 1, score is between left and right, BETWEEN = 1, if score is above right, ABOVE = 1.

Best Answer

this will find the correct row and pass the two variables to the Match which then passes it to the outer INDEX to choose the correct value.

If this value matches the title a 1 is placed or 0 if not:

=IF(OR($K2<18,$J2="Missing"),"",--(M$1=IFERROR(INDEX({"BETWEEN","ABOVE"},MATCH($L2,INDEX($F:$G,MATCH($J2,$A:$A,0)+MATCH($K2,$B$2:$B$7)-1,0))),"BELOW")))

enter image description here

Related Question