Search code examples
google-sheetsvlookuparray-formulas

Google Sheets - If value in cell X is between minimum value in column A and maximum value in column B then return related value in column C


Example

I have two columns defining the minimum (A) and maximum (B) (of correct answers). Pupils results are in column C and Grades in D.

What I am trying to do is check is a number of correct answers and then show the corresponding grade.

The formula works for E2. The formula only works for E2.

What am I doing wrong?


Solution

  • =IFERROR(ARRAYFORMULA(VLOOKUP(C2:C;
     {QUERY(IFERROR(
      (A2:A); ); "SELECT Col1")\
      QUERY(A2:D; "SELECT D")}; 2)); )