Dynamic dropdown menu in excel (ideally not VBA)

Viewed 84

I'm trying to create a dropdown menu in excel which eliminates values once they have been selected.

Let's assume that the dropdown offers the values 1...10. If I select 1 in the first dropdown, then the other dropdowns needs to offer only 2...10. Likewise, if I picked to, the the other should offer only 1,3,4,5,6,7,8,9,10.

Basically we want managers to rank their employees based on the performance value. But if they rate everyone a 4, we need a ranking - but we then dont want them ranking everyone as 1.

I tried with IF statements, but we can have rankings of up to 100 people, so it was becoming a nightmare.

Not sure if I am clear?

Any help would be appreciated.

enter image description here

2 Answers

You can use data validation custom formula to avoid duplicates. It would not be a dropdown but it would work exactly as you wish:

enter image description here

In my example, I've selected range B2:B5 and then I applied a data validation custom formula like this:

enter image description here

=COUNTIFS($B$2:$B$5;B2)=1

You can even customize the error message:

enter image description here

With that formula, any entered value will be accepted exactly once. If it's used again, it will raise an error.

enter image description here

Notice I can't type a second time the value 1 because it's been already used.

You can do this by creating a helper table which lists all the valid ranks and whether or not they have been used yet. This can be on the same sheet or another, hidden sheet if you prefer:

enter image description here

The formula in the "Used?" column is a simply counts the number of times that rank appears in the "Rank" column and checks if it is greater than 0 - returning TRUE or FALSE:

=COUNTIFS($B$2:$B$11,$H2)>0

The "Remaining Ranks" column then uses this in a MINIFS formula to remove the used ranks:

 = MINIFS(
    $H$2:$H$11,
    $H$2:$H$11,">"&MAX($K$1:$K1),
    $I$2:$I$11,FALSE
)

This is saying to select the lowest number from the "All Ranks" column, where the rank hasn't already been listed in the "Remaining Ranks" column AND the "Used?" column is FALSE.

This will result in zeros at then bottom of the "Remaining Ranks", so we can wrap it in an if statement to replace the zeros with an empty string "":

=IF(
    MINIFS($H$2:$H$11,$H$2:$H$11,">"&MAX($K$1:$K1), $I$2:$I$11,FALSE)=0,
    "",
    MINIFS($H$2:$H$11,$H$2:$H$11,">"&MAX($K$1:$K1),$I$2:$I$11,FALSE)
)

You can now use the "Remaining Ranks" column as your source for the data validation list, and it will update as the ranks are entered.

enter image description here

This will result in some blank options at the bottom of the list. If these are an issue for you, they can be removed by using an INDEX formula in a named range. Let me know if you would like me to explain how that can be done.

Related