简体   繁体   English

如果条件不匹配,则给出下拉列表

[英]give drop-down list if condition not matched

wanting to use an IF statement (or whatever will do the job) to populate a cell (cell B) based on what was entered in another cell (Cell A), but if Cell A doesn't = x, then I want users to be able to select an answer from a drop-down list想要使用 IF 语句(或任何可以完成工作的语句)根据在另一个单元格(单元格 A)中输入的内容填充单元格(单元格 B),但是如果单元格 A 不 = x,那么我希望用户能够从下拉列表中选择答案

eg =IF(B23="Softphone", "Yes", drop-down list )例如 =IF(B23="Softphone", "Yes", drop-down list )

So if Cell A = Softphone, then Cell B is auto-populated with 'Yes'.因此,如果 Cell A = Softphone,则 Cell B 会自动填充“Yes”。 If Cell A = anything else, then Cell B becomes a drop-down list如果单元格 A = 其他任何内容,则单元格 B 成为下拉列表

Is this possible?这可能吗?

I may be wrong but I don't think you can do that with IF statements ie returning a drop-list if the False condition is returned in your IF statement.我可能是错的,但我认为你不能用 IF 语句来做到这一点,即如果在你的 IF 语句中返回 False 条件,则返回一个下拉列表。

However, you can work around this with a slightly different layout on your worksheet.但是,您可以在工作表上使用稍微不同的布局来解决此问题。 Try this formula:试试这个公式:

=IF(B23="Softphone", "Yes",IF(D23="","Select option in column D",D23)) =IF(B23="软电话", "是",IF(D23="","选择 D 列中的选项",D23))

In column D (using the Excel ribbon, select Data and then Data Validation), create a drop-down list of what you want if it's not "Softphone" in column B.在 D 列(使用 Excel 功能区,选择数据,然后选择数据验证)中,如果 B 列中的不是“软电话”,则创建您想要的下拉列表。

Then, if the input in column B isn't "Softphone", it'll ask the user to select an option from the drop-down list in column D. And if it's blank - it'll show show as a default of 'Select option in column D' like a prompt to the user.然后,如果 B 列中的输入不是“Softphone”,它会要求用户从 D 列的下拉列表中选择一个选项。如果它是空白的 - 它会显示为默认值 '选择 D' 列中的选项,就像对用户的提示一样。

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

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