Search code examples
libreoffice-calc

Connect two cells via a "common data validity table"?


how can I select a value for cell A and then have a cell B automatically show the respective entry according to a given table?

Example: table of numerical grades and their textual equivalents:

1 | very good
2 | good
3 | sufficient

In cell A, I want to select a number through a drop-down, say "3".

Then another cell B should automatically show "sufficient".

What is the formula to write into cell B so that I can use a table or similar structure to be able to easily recalculate the sheet?

Thank you in advance for your time and help! digisus

PS. If the question has been answered before, sorry. I tried but could not figure out what to search for aside from "cell referencing" which led nowhere.


Solution

  • The function is VLOOKUP.

    1. Enter the table in D2 through E4.
    2. Select cell A1 and go to Data -> Validity.
    3. Allow Cell Range $Sheet1.$D$2:$D$4. Press OK.
    4. Formula for B1 is =VLOOKUP(A1;D2:E4;2;1).

    Now when 2 is selected from the drop-down list in A1, then B1 displays good.

    2 produces "good"