------------------------------------------------------------------------------------------------------------------------
身份证号码中提取年龄、性别、出生年月日和利用数据有效性限制字符长度
1、身份证当中提取性别函数公式:=IF(MOD(RIGHT(LEFT(F166,17)),2)=1,"男","女")
=IF(OR(LEN(B1)=15,LEN(B1)=18),IF(MOD(MID(B1,15,3)*1,2),"男","女"),"")
2、身份证当中提起出生年月函数公式:=IF(LEN(F166)=15,"19"&MID(F166,7,2)&"."&MID(F166,9,2),MID(F166,7,4)&"."&MID(F166,11,2))
3、利用数据有效性限制输入字符的长度公式:=OR(LEN(A2)=15,LEN(A2)=18)
--------------------------------------------------------------------------------------------------------------------------
利用身份证号提取年龄=IF(LEN(B2)=15,2012-VALUE(MID(B2,7,2)),if(LEN(B2)=18,2012-VALUE(MID(B2,7,4)),"身份证错"))
-------------------------------------------------------------------------------------------------------------
自动填入相同信息函数代码:=IF(EXACT(C233,""),"","城镇居民")
------------------------------------------------------------------------------------------------
删除身份证末尾字符的公式:=LEFT(M6,LEN(M6)-1)(删除几个字符,就将“1”改成几就行了)
------------------------------------------------------------------------------------------
公众平台添加文字链接代码:<a href="链接地址">链接文字</a>
-----------------------------------------------------------------------------------------------
对于同时满足A条件和B条件的单元格的统计的函数:
条件描述:在A列当中内容为性别,B列当中的内容为1-100岁的年龄的人
要求:是用什么函数可以统计出年龄在15到20岁之间的女性,和年龄在15到20岁之间的男性!
具体函数公式:=SUMPRODUCT((A1:A100="男")*(B1:B100>=15)*(B1:B100<=20))
=AND(OR(LEN(F4)=15,LEN(F4)=18),ISNUMBER(F4))
=AND(OR(LEN(H4)=7,LEN(H4)=11),ISNUMBER(H4))
(删除空白行的宏语言)
----------------------------------------------------------------------------------------
Sub 删除段落首尾空格及空行()
With ActiveDocument.Content.Find
.Execute findtext:="^l", replacewith:="^p", Replace:=wdReplaceAll
.Execute findtext:="^13", replacewith:="^p", Replace:=wdReplaceAll
.Execute findtext:="(", replacewith:="(", Replace:=wdReplaceAll
.Execute findtext:=")", replacewith:=")", Replace:=wdReplaceAll
End With
SendKeys "^(aej)", True
Dim i As Paragraph
For Each i In ActiveDocument.Paragraphs
If Len(i.Range) = 1 Then i.Range.Delete
Next
End Sub
---------------------------------------------------------------------------------------
以下为数字转化文字的宏语言
-----------------------------------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target A
s Range)
Dim rRng As Range
Set rRng = Application.Intersect(Target, Range(" f6:f48"))
If rRng Is Nothing Then End
Dim rCell As Range
mid函数提取年月日For Each rCell In rRng
Select Case rCell.Value
Case 1
rCell.Value = "小学"
Case 2
rCell.Value = "初中"
Case 3
rCell.Value = "高中"
Case 4
rCell.Value = "中专"
Case 5
rCell.Value = "大专"
Case 6
rCell.Value = "本科"
End Select
Next
End Sub
------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rRng As Range
Set rRng = Application.Intersect(Target, Range(" m6:m48"))
If rRng Is Nothing Then End
Dim rCell As Range
For Each rCell In rRng
Select Case rCell.Value
Case 1
rCell.Value = "营业员"
Case 2
rCell.Value = "清洁工"
Case 3
rCell.Value = "售货员"
Case 4
rCell.Value = "保姆"
Case 5
rCell.Value = "司机"
Case 6
rCell.Value = "门卫"
Case 7
rCell.Value = "快递员"
Case 8
rCell.Value = "水暖工"
Case 9
rCell.Value = "快递员"
Case 10
rCell.Value = "送水员"
Case 11
rCell.Value = "修理工"
End Select
Next
End Sub
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
Excel中COUNTIF函数的使用方法汇总
一、求各种类型单元格的个数
(1)  求真空单元格单个数:    =COUNTIF(data,"=")
(2)  真空+假空单元格个数:    =COUNTIF(data,"")      相当于countblank()函数
(3)  非真空单元格个数:      =COUNTIF(data,"<>")    相当于counta()函数
(4)  文本型单元格个数:      =COUNTIF(data,"*")    假空单元格也是文本型单元格
(5)  区域内所有单元格个数:  =COUNTIF(data,"<>""")
(6)  逻辑值为TRUE的单元格数量  =COUNTIF(data,TRUE)
小说明:
EXCEL单元格内数据主要有以下几类:数值型,文本型,逻辑型,错误值型。其中时间类型也是一种特殊的数值。文本类型的数字是文本型。
空单元格:指什么内容也没有的单元格,姑且称之为真空。
假空单元格:指0字符的空文本,一般是由网上下载来的或公式得来的,姑且称之为假空。
date指单元格区域,该参数不能是数组
二、求><=某个值的单元格个数
(1) 大于50                            =COUNTIF(data,">50")
(2) 等于50                            =COUNTIF(data,50)
(3) 小于50                            =COUNTIF(data,"<50")
(4) 大于或等于50                      =COUNTIF(data,">=50") 
(5) 小于或等于50                      =COUNTIF(data,"<=50") ¬
(6) 大于E5单元格的值                =COUNTIF(data,">"&$E$5) 
(7) 等于E5单元格的值                =COUNTIF(data,$E$5) 
(8) 小于E5单元格的值                =CO
UNTIF(data,"<"&$E$5) 
(9) 大于或等于E5单元格的值            =COUNTIF(data,">="&$E$5)
(10) 小于或等于E5单元格的值          =COUNTIF(data,"<="&$E$5)
三、等于或包含某N个特定字符的单元格个数
(1) 两个字符                        =COUNTIF(data,"??")
(2) 两个字符并且第2个是B          =COUNTIF(data,"?B") 
(3) 包含B                          =COUNTIF(data,"*B*")
(4) 第2个字符是B                  =COUNTIF(data,"?B*")
(5) 等于“你好”                    =COUNTIF(data,"你好") 
(6) 包含D3单元格的内容            =COUNTIF(data,"*"&D3&"*")
(7) 第2字是D3单元格的内容        =COUNTIF(data,"?"&D3&"*")
注:countif()函数对英文字母不区分大小写,通配符只对文本有效
四、两个条件求个数
(1)    >10并且<=15        =SUM(COUNTIF(data,">"&{10,15})*{1,-1}) 
(2)    >=10并且<15        =SUM(COUNTIF(data,">="&{10,15})*{1,-1}) 
(3)    >=10并且<=15      =SUM(COUNTIF(data,{">=10",">15"})*{1,-1})
(4)    >10并且<15          =SUM(COUNTIF(data,{">10",">=15"})*{1,-1})
注:一般多条件计数使用SUMPRODUCT函数,以上方法较少使用,仅供参考。
补充:三个区域计数:
三个区域中>=60        =SUM(COUNTIF(INDIRECT({"a46:a48","b48:b50","c47:c48"}),">=60"))
五、各种特殊统计要求的计算    A2:A32 为存放数据的区域
(1)非空文本(仅包括可键入文本)  =COUNTIF(A2:A32,">=!") 
(2)所有非空文本
=COUNTIF(A2:A32,">=!")+COUNTIF(A2:A32,">="&CHAR(1))-COUNTIF(A2:A32,">= ") 
或  {=SUM(COUNTIF(A2:A32,">="&{"!"," "})*{1,-1})+COUNTIF(A2:A32,">="&CHAR(1))}
(3)全部可见单元格 
{=SUM(N(IF(ISERROR(A2:A32),1,SUBSTITUTE(A2:A32," ",""))<>""))}
(4)有效可见单元格 
=COUNTIF(A2:A32,">=!")+COUNTIF(A2:A32,">="&CHAR(1))-COUNTIF(A2:A32,">= ")+COUNT(A2:A32)
(5)全部不见单元格(真空+空格+空文本)
=COUNTIF(A2:A32,"")-COUNTIF(A2:A32,">=!")+COUNTIF(A2:A32,">= ")
(6)空格  =COUNTIF(A2:A32,">= ")-COUNTIF(A2:A32,">=!") 
(7)空文本""  =COUNTIF(A2:A32,"")-COUNTIF(A2:A32,"=")
(8)逻辑与错误  =COUNTIF(A2:A32,"<>")-COUNTIF(A2:A32,"*")-COUNT(A2:A32)
-----------------------------------------------------------------------------------------------------------

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。