Reputation: 4200
I have a simple list with labels and values in a Google Spreadsheet. Below, I have some fields in which I would like to get the value when writing the label.
For example, if I write D
in a cell, I want the next cell to show 4
, the value corresponding to D
.
This can of course be done with repetitive IF
s inside IF
s inside IF
s... in cell B8
, like this:
=IF(A8=A1;B1; IF(A8=A2;B2; IF(A8=A3;B3; IF(A8=A4;B4; IF(A8=A5;B5;0)))))
This simply checks row by row: If the written value matches the label of row 1, then show the value. If not, then perform a new IF
command on the second row. Etc.
With many rows this is quite tedious. Is it possible in Google Spreadsheets to simplify this a bit? For instance, can I in some way collect all cells in a column in one IF
statement by doing A1:A5
or something like that? Something along the lines of:
=IF(A8=A1:A5;B1:B5;0)
Upvotes: 1
Views: 29