怎么提取Excel表格中特定字
求助一下各位大神,怎么把A列里文字中的男和女分别提取到B列中,详情见附件。谢谢=LOOKUP(99,FIND({"男","女"},A2),{"男","女"}) =MID(A2,CONCAT(IFERROR(FIND({"男","女"},A2),"")),1) 三键结束下拉 =LOOKUP(1,-FIND({"","男","女"},A2),{"","男","女"}) =IF(COUNTIF(A2,"*男*"),"男","女") 大佬,我特意试了一下,将单元格都改成包含男女的内容,然后用公式试了一下,结果显示为女,为什么不显示男呢? B2=LOOKUP(99,FIND({"男","女","男女","女男"},A2),{"男","女","男女","女男"}) 非常感谢 Sub 宏1()
Dim rng As Range
On Error Resume Next
Set rng = Application.InputBox(prompt:="请选择你要替换的单元格区域", Title:="替换", Type:=8)
On Error GoTo 0
rng.Replace What:="*女男*", Replacement:="女男", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
rng.Replace What:="*男女*", Replacement:="男女", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
rng.Replace What:="*男*", Replacement:="男", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
rng.Replace What:="*女*", Replacement:="女", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub 正则表达式,把“男”、“女”的之外的字符都替换为空:
[^男女]+