Excel用单个值替换多组值

问题描述 投票:-1回答:1

考虑具有以下不同值的Excel工作表列:

Dell Latitude 4580
Dell Latitude 1520
Lenovo 820
Acer 220
Acer 530
Acer 230

例如,我想将这些值“映射”到更常见的组中

Dell Latitude 4580 -> Laptop 2-core
Dell Latitude 1520 -> Laptop 4-core
Lenovo 820 -> Desktop 2-core
Acer 220 -> Desktop 2-core
Acer 530 -> Desktop 4-core
Acer 230 -> Laptop 4-core

如何使用Excel公式有效地完成这项工作?目前我是嵌套替代品:substitute(substitute(cell; "Dell Latitude 4580"; "Laptop 2-core");"Dell Latitude 1520";"Laptop 4-core")...

但这只是丑陋而且不那么可扩展。任何的想法 ?

excel vba excel-vba excel-formula
1个回答
2
投票

使用您的输入和所需输出创建一个表:

enter image description here

然后,您可以使用VLOOKUP返回所需的输出:

=VLOOKUP(A1,E:F,2,FALSE)

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.