简体   繁体   English

如何将 IF 公式与 Excel 中的下拉列表结合使用?

[英]How do I combine an IF formula with a dropdown in Excel?

Here's what I am trying to achieve.这就是我想要实现的目标。 If a student earns a grade 1* or a 1, they do not get a key.如果学生获得 1* 或 1 的成绩,他们将无法获得钥匙。 If they earn a grade 2 or 3, the teacher then chooses from these keys: A - Attendance B - Behaviour C - Classwork L - Lateness O - Organization H - Homework.如果他们获得 2 或 3 级,那么教师会从以下键中进行选择:A - 出勤 B - 行为 C - 课堂作业 L - 迟到 O - 组织 H - 家庭作业。

What I want to do is, create a drop-down with the options 1*,1,2,3.我想要做的是,使用选项 1*、1、2、3 创建一个下拉列表。 If the teacher selects 2 or 3, it will then provide another drop down with the keys(A,B,C,H,L,O).如果教师选择 2 或 3,它将提供另一个下拉菜单(A、B、C、H、L、O)。 I know this can somehow be done using dependent drop downs but somehow this doesn't work for me.我知道这可以以某种方式使用依赖下拉菜单来完成,但不知何故这对我不起作用。

What I have done so far: I have a column labelled "Grades" with a dropdown menu listing 1*,1,2,3.到目前为止我所做的:我有一个标有“成绩”的列,其中包含一个列出 1*、1、2、3 的下拉菜单。 I then created another column with the label "key" and used the data validation method and the formula "=INDIRECT".然后,我使用 label“key”创建了另一列,并使用了数据验证方法和公式“=INDIRECT”。

What happens then is that the "key" column doesnt give me a dropdown menu.然后发生的是“关键”列没有给我一个下拉菜单。 It's just a blank cell.它只是一个空白单元格。

What am I doing wrong?我究竟做错了什么?

Here is a workaround,这是一个解决方法,

use a table, I use the name "tbl_gradechoose" for it.使用一个表,我使用它的名称“tbl_gradechoose”。 For every grade a column.每个年级有一栏。 Use the Datavalidation, choose List and as source the formula使用数据验证,选择列表并将公式作为源

=INDIRECT("tbl_gradechoose[" & A1 &"]")

Here shown in englisch Excel Version:此处显示为英文 Excel 版本: 在此处输入图像描述

Here shown in the German Version in Excle:此处显示在 Excle 中的德语版本中: 在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM