Forum Discussion
Use of table names within formulas
Hello to all,
I have a problem when trying to use a table name within a formula. I'm using Excel 2016 in Win10. What I try to do is the following:
- in a same spreadsheet, I have defined several tables (i.e., course1, course2, course3, select); course1, 2 and 3 contain the data of the alumns (name and phone) of three different courses; all three tables have the same number and names of columns (say, number, name, phone), but are of different length (i.e., course1 have 6 persons, course2 have 7, and course3 have 8). In example, 'course1' is
number name phone
1 Johnny 555 3355
2 Mary 555 3356
etc.
In 'select', I have the names of the other tables (that is, three lines with "course1", "course2" and "course3").
- I have created a dropdown menu based on 'select' table, to select the name of a course table (this menu is, i.e., in cell A1)
- My intention is to show a listing of the alumns depending on the table name I select in the dropdown menu. For this purpose, cells A3-A11 contains a number (1 - 8, which is the maximum number of alumns), and cells B3-B11 contain the following formulae:
=IF.ERROR(VLOOKUP(A3;A1;2;FALSE);"---") // A3 to A11, depending on the line
and cells C3-C11 contain:
=IF.ERROR(VLOOKUP(A3;A1;3;FALSE);"---") // A3 to A11, depending on the line
However, this doesn't work and A3-B11 show "---". If I write the name of the table, it works and the correct listing is shown:
=IF.ERROR(VLOOKUP(A3;course1;2;FALSE);"---")
What am I doing wrong? How can I do all these?
1 Reply
- SergeiBaklanDiamond Contributor
You shall use INDIRECT(A1) within the formula to reference the table.