excel要用正则只能用VBA了, 给你写了一个自定义函数,代码如下:
Option Explicit
Function smatch(ByVal str As Variant)
Dim mc As Variant
smatch = "no_match"
With CreateObject("vbscript.regexp")
.Global = False
.Pattern = "^adm1.*(09|67)$"
If .test(str) Then
Set mc = .Execute(str)
smatch = mc.Item(0)
End If
End With
Set mc = Nothing
End Function
function_sample
code
INDEX+SMALL函数不可以吗?
=IFERROR(INDEX(A:A,SMALL(IF((LEFT(A:A,4)="admin1")*((right(A:A,2)="09")+(RIGHT(A:A,2)="67")),ROW(A:A),""),ROW(A1))),"")
用组公式