在单元格D1
"User Name: Hari Prasad
User ID: INHPR9
Machine Name: BNGRET-L-99950
SoldtoCode: 10005625"
D2
"User Name: Stuart Macdonald
Machine Name: LONSC-L-97778
SoldtoCode: 10003058"
我写了fr
E1
=IF(FIND("User",D1,5),LEFT(D1,FIND("User",D1,5)),LEFT(D1,FIND("Machine",D1)))
E2
=IF(FIND("User",D2,5),LEFT(D2,FIND("User",D2,5)),LEFT(D2,FIND("Machine",D2)))
RESULT
E1=User Name: Hari Prasad
E2=#VALUE ERROR
答案 0 :(得分:2)
将其放入E2
= IF(NOT(ISERROR(FIND( “用户”,D2,5))),LEFT(D2,FIND( “用户”,D2,5)),LEFT(D2,FIND( “机器”,D2 )))
如果FIND函数找不到文本,则返回错误,而if语句的文本不能为FALSE。