我正在开展一个项目,我需要找到某些单词并将其替换为另一列中的数字。但是,我无法找到一种方法使其适用于大量信息
例如:A是我获取旧信息的列。 B是我需要获取旧信息并将其替换为C列中给出的数字代码的地方
A B C
Single 01 Single = 01
Single 01 Married = 02
Single 01 Unknown = 98
Married 02 Divorced = 99
unknown 98 Separated = 05
Divorced 99
Separated 98
我不确定如何让它发挥作用。所以任何帮助都将不胜感激。
答案 0 :(得分:1)
Rob,你查找范围必须是两列布局,而不是单列,因为你拥有它。 假设您的数据从第1行开始,您当前的查找范围是C1:C5。我会做以下事情:
1) Assign cell C1 to value of "Single", C2 = "Married", C3 = "Unknown", C4 = "Divorced", C5 = "Separated".
2) D1 should be "01", D2 = "02", D3 = "98", D4 = "99", D5 = "05"
3) B1 = =VLOOKUP($A1,$C$1:$D$5,2,)
4) Copy this formula down so B7 =VLOOKUP($A7,$C$1:$D$5,2,)
5) If you like to handle any errors and assign unknown values to "98", you can change cell B1 to have this formula instead: =IFERROR(VLOOKUP($A1,$C$1:$D$5,2,),"98")