杺洳芷渁 发表于 2021-12-3 01:27:56

=LOOKUP(1,-FIND({"","男","女"},A2),{"","男","女"})

浦大勋 发表于 2021-12-6 05:49:35

=IF(COUNTIF(A2,"*男*"),"男","女")

張德賢 发表于 2021-12-17 08:01:07

大佬,我特意试了一下,将单元格都改成包含男女的内容,然后用公式试了一下,结果显示为女,为什么不显示男呢?

专业电镀 发表于 2021-12-17 15:52:59

B2=LOOKUP(99,FIND({"男","女","男女","女男"},A2),{"男","女","男女","女男"})

应天骑士 发表于 2021-12-21 22:49:16

非常感谢

小茶壺 发表于 2021-12-26 11:58:02

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

表面材料 发表于 2022-1-2 18:10:30

正则表达式,把“男”、“女”的之外的字符都替换为空:
[^男女]+
页: 1 2 [3]
查看完整版本: 怎么提取Excel表格中特定字