Home » excel » excel – IF THEN (sourcing a table on Sheet 2)

excel – IF THEN (sourcing a table on Sheet 2)

Posted by: admin May 14, 2020 Leave a comment

Questions:

I’m looking to create an Excel spreadsheet using what I think is a bit of a complicated IF/THEN. I want to have a table on Sheet 2 that gives a value in one column (e.g., Column A: Between 5 and 5.5), and another value in Column B (e.g., A-).

On Sheet 1, I will have a column (e.g., F) that has the number that should fall somewhere within Column A. I would like to automatically update Column I with the value that is in Column B on Sheet 2.

So I want to have a formula in cells in Column I that looks at the value in Column F (and refers to the relationship between these values in Columns A & B in Sheet 2).

Is this doable?

The table in Sheet 2 would be:

 15 | A+ 
 14 | A
 13 | A-
 12 | B+
 11 | B
 10 | B-
 09 | C+
 08 | C
 07 | C-
 06 | D+
 05 | D
 04 | D-
 03 | E+
 02 | E
 01 | E-
How to&Answers:

Using nested IFs is a horrible idea, you should consider using a lookup table instead.

enter image description here

Answer:

The last parameter of VLOOKUP is probably what you are looking for. Setting it to true makes the function looks for approximate match instead of exact match.

You will need sort your table in ascending order (i.e. from 1(E-) to 15(1+)).

Answer:

=LOOKUP(F1,Sheet2!A1:A3,Sheet2!B1:B3)
Try this Code put in the Sheet 1. Column I

Answer:

If you are using Excel 365, you can use the new IFS statement.

=IFS(A1<=1,"E-",A1<=2,"E",A1<=3,"E+",A1<=4,"D-",A1<=5,"D",A1<=6,"D+",A1<=7,"C-",A1<=8,"C",A1<=9,"C+",A1<=10,"B-",A1<=11,"B",A1<=12,"B+",A1<=13,"A-",A1<=14,"A",A1<=15,"A+")

That said, since you already have a table on your second sheet, I would highly recommend using an INDEX/MATCH method as suggested by @Michal Rosa