我有数据,并希望使用公式来确定安装的版本是x86还是x64:
OSTYPE SHORTPATH VERSION VERSIOND
Microsoft Windows 7 Enterprise Edition, 64-bit C:\PROGRAM FILES (X86)\JAVA\JRE1.8.0_45\BIN\ 8.0.45.14 8.0.45.14 x86
Microsoft Windows 7 Enterprise Edition, 64-bit C:\PROGRAM FILES\JAVA\JRE1.8.0_66\BIN\ 8.0.660.18 8.0.660.18 x64
Microsoft Windows 7 Enterprise Edition, 32-bit C:\PROGRAM FILES\JAVA\JRE6\BIN\ 6.0.510.9 6.0.510.9 x86
意图是VERSIOND
将包含VERSION值,然后为{32}安装添加x86
或64位安装添加x64
。
If SHORTPATH contains "(x86)" then it's a 32bit install
If SHORTPATH doesn't contain "(x86)" and OSTYPE contains "64-bit" then it's a 64bit install
If SHORTPATH doesn't contain "(x86)" and OSTYPE contains "32-bit" then it's a 32bit install
我几乎通过以下方式开展工作:
=IF(ISERROR(SEARCH("(x86)";D2));IF(SEARCH("64-bit";C2)>0;CONCATENATE(E2;" x64");CONCATENATE(E2;" x86"));CONCATENATE(E2;" x86"))
C列为OSTYPE
,D列为SHORTPATH
,E栏为VERSION
。
除非OSTYPE
为32位,否则会有效,因为SEARCH("64-bit";C2)>0
返回#VALUE!
'
如何添加第二个ISERROR来处理该错误?
答案 0 :(得分:0)
假设您希望E列中的结果与" 86"如果SHORTPATH包含"(x86)"或OSTYPE包含32位,否则您希望它与" 64"您可以使用OR
来描述何时使用" 86"甚至没有明确地搜索" 64-bit":
=IF(OR(NOT(ISERROR(SEARCH("(x86)",D2))),NOT(ISERROR(SEARCH("32-bit",C2)))),CONCATENATE(E2," x86"),CONCATENATE(E2," x64"))
以上内容已经过测试,但您似乎正在使用;
代替,
的区域设置,所以我想这会是:
=IF(OR(NOT(ISERROR(SEARCH("(x86)";D2)));NOT(ISERROR(SEARCH("32-bit";C2))));CONCATENATE(E2;" x86");CONCATENATE(E2;" x64"))
答案 1 :(得分:0)
较短的版本:
=E2&" "&IF(AND(ISERROR(SEARCH("x86";D2));NOT(ISERROR(SEARCH("64-bit";C2))));"x64";"x86")