广州骏丰电脑 发表于 2021-9-27 11:40:00

怎么提取Excel表格中特定字

求助一下各位大神,怎么把A列里文字中的男和女分别提取到B列中,详情见附件。谢谢

瑞金 发表于 2021-9-27 23:56:14

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

陈梦吉 发表于 2021-9-29 05:29:23

=MID(A2,CONCAT(IFERROR(FIND({"男","女"},A2),"")),1) 三键结束下拉

盧相宇 发表于 2021-10-10 06:37:40

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

楠汐 发表于 2021-10-11 18:43:11

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

宝宝姥爷 发表于 2021-10-12 09:18:15

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

南巷小瑾 发表于 2021-10-12 23:28:23

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

用户文大叶 发表于 2021-10-16 13:48:53

非常感谢

鸭先知 发表于 2021-10-17 16:32:40

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

晴聆 发表于 2021-10-18 05:44:13

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