浓眉大眼的国哥 发表于 2022-2-12 18:16:07

直接上代码了吗?公式处理不了吗

随风漂散 发表于 2022-2-15 15:03:06

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

雾海榛 发表于 2022-2-17 03:56:23

=IFERROR(FILTERXML("<a><b>"&SUBSTITUTE($A1,"-","</b><b>")&"</b></a>","//bla!st()")&"]"),"")

固戍老黄 发表于 2022-2-21 11:19:46

学艺不精,凑活着用
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)),"")

擒流感 发表于 2022-2-21 16:08:57

371KK01-371W-378M
以这个来说事吧
第一个是371W第二个为空   最后一个为371W是这规则吗

吴顺 发表于 2022-2-27 19:07:37

Sub RegExp()
Dim RegExp, i%, Match
For i = 2 To Range("A" & Rows.Count).End(xlUp).Row
Set RegExp = CreateObject("vbscript.regexp")
RegExp.Pattern = "\d+W"
RegExp.Global = True
Set Match = RegExp.Execute(Cells(i, 1))
Cells(i, 2) = Match(0)
If Match.Count > 1 Then Cells(i, 3) = Match(1)
If Match.Count > 2 Then Cells(i, 4) = Match(Match.Count - 1)
Next i
End Sub

华丰自助火锅羊肉串 发表于 2022-3-1 14:47:43

回复就是例子啊。只有一个,最后一个与第一个不是重合吗?你不能说只有一个就没有最后一个。
页: 1 2 3 [4]
查看完整版本: 如何提取一窜数字里面想要的符号