从下拉列表中选择,但在Excel中为单元格添加不同的值 [英] Select from drop list but add different value to cell in Excel

查看:277
本文介绍了从下拉列表中选择,但在Excel中为单元格添加不同的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有从Excel中的下拉列表中选择,而不是添加到单元格中的列表中的选定值添加了不同的值。
例如A1中的下拉列表包含A,B,C,D,E。
如果从列表中选择A,则将1添加到单元格A1,如果从列表中选择B,则将2添加到单元格A1 ...等等。
这可以通过数据验证列表或VBA中的公式来实现。
提前感谢

Is there anyway to select from a drop down list in Excel but instead of the selected value in list being added into the cell a different value is added. e.g. Drop down list in A1 contains A, B, C, D, E. If I select A from list, 1 is added to cell A1, If I select B from list, 2 is added to cell A1... and so on. Can this be achieved with a formula in Data Validation List or VBA. Thanks in advance.

推荐答案

您可以使用常规数据验证,然后使用条件格式来检查单元格的值(您的示例将需要5种不同的条件格式,每种可能值一个),然后将条件格式设置为自定义格式。例如,要显示1,自定义格式将为 ;;;1

You could use a regular data validation, and then have a conditional format that checks the cell's value (your example would need 5 different conditional formats, one for each possible value), and then set the conditional format to be a custom format. For example, to show a 1, the custom format would be ;;;"1"

这篇关于从下拉列表中选择,但在Excel中为单元格添加不同的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆