如何提取一窜数字里面想要的符号
例如:373AH05-3731W-371W-022W-3163W-0335A,提取第一个带有W的文字,提取第二个带有W的文字,提取最后一个带有W的文字,=TRIM(MID(SUBSTITUTE($A2,"W",REPT(" ",99)),COLUMN(A1)*99-98,99)) 就是这样的结果,第二行的那种,公式怎么设置呢 还以为第一个是3731W,第二个371W,第四个3163W
直接上代码了吗?公式处理不了吗 Sub FilterW()
r = Cells(Rows.Count, 1).End(xlUp).Row
ar = Range("A2").Resize(r, 2)
ReDim br(1 To r, 1 To 3)
For i = 1 To r - 1
ss = Filter(Split(ar(i, 1), "-"), "W")
n = UBound(ss)
If n > -1 Then
br(i, 1) = ss(0)
br(i, 3) = ss(n)
End If
If n > 0 Then br(i, 2) = ss(1)
Next
Range("B2").Resize(r, 3) = br
End Sub =IFERROR(FILTERXML("<a><b>"&SUBSTITUTE($A1,"-","</b><b>")&"</b></a>","//bla!st()")&"]"),"")
学艺不精,凑活着用
B2输入=IFERROR(TRIM(MID(SUBSTITUTE($A2,"-",REPT(" ",99)),SEARCHB("W",SUBSTITUTE($A2,"-",REPT(" ",99)),1)-98,99)),"")
C2输入=IFERROR(TRIM(MID(SUBSTITUTE($A2,"-",REPT(" ",99)),SEARCHB("W",SUBSTITUTE($A2,"-",REPT(" ",99)),SEARCHB("W",SUBSTITUTE($A2,"-",REPT(" ",99)),1)+1)-98,99)),"")
D2输入=IFERROR(TRIM(MID(SUBSTITUTE($A2,"-",REPT(" ",99)),SEARCH("W",SUBSTITUTE($A2,"-",REPT(" ",99)),(SEARCHB("W",SUBSTITUTE($A2,"-",REPT(" ",99)),SEARCHB("W",SUBSTITUTE($A2,"-",REPT(" ",99)),1)+1)+1))-98,99)),"") 371KK01-371W-378M
以这个来说事吧
第一个是371W第二个为空 最后一个为371W是这规则吗