D
D
Dmitry Egregor2021-08-13 10:32:34
excel
Dmitry Egregor, 2021-08-13 10:32:34

How to set up the "IF" statement correctly?

I need to set up a cell so that it works with a drop down list.
In the drop-down list, the list of names "Andrey, Anton, Vlad, Maxim, Kolya". I need the IF operator to check the combo box and return - "word".
For example:
Andrey, Vlad = first
Anton, Kolya = second
Maxim = third

Found something like:

=IFS(E9 = "Андрей"; "первый"; E9 = "Антон"; "второй"; E9 = "Максим"; "третий")

But this option only works with three names. What if there are 50 names?

PS:
Everything works great!
And what should be added to the string so that it does not issue #N/ A when the string is empty?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Grigory Boev, 2021-08-13
@EGREGOR_Dmitriy

In this case, the easiest way is to start a directory on a separate sheet, and look for a match there.
And if you want without a separate reference, you can do this: through VLOOKUP (query; range; index; [sorted]) and an array literal , like this:

=ВПР(E9;{
  "Андрей"\"1й";
  "Антон"\"2й";
  "Максим"\"3й"
};2;0)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question