1、 首先,打开 Excel,并按下 Alt + F 11 进入 Visual Basic for Applications(VBA)编辑器。2、 在 VBA 编辑器中,选择插入 -> 模块,然后在模块中插入以下代码:Function CalculateAge(id As String) As Integer Dim birthDate As Date birthDate = DateSerial(Mid(id, 7, 4), Mid(id, 11,...
2、 在 VBA 编辑器中,选择插入 -> 模块,然后在模块中插入以下代码: Function CalculateAge(id As String) As Integer Dim birthDate As Date birthDate = DateSerial(Mid(id, 7, 4), Mid(id, 11, 2), Mid(id, 13, 2)) CalculateAge = DateDiff("yyyy", birthDate, Date)End Function 提示:如果...
age = age - 1 End If CalculateAge = age End Function ``` 步骤4:按下Ctrl + S保存宏。 步骤5:返回Excel表格,使用以下公式来调用宏: =CalculateAge(出生日期) 其中,"出生日期"是你输入出生日期所在的单元格。 这样,你就可以实现一个自动更新的年龄计算了。每当出生日期发生变化时,年龄值也会自动更新。
Read More:How to Calculate Age Between Two Dates in Excel Formulas to Calculate Age in Years Only Apart from the two methods described, you can also use some other formulas to calculate age in Excel if you want to find your age in years. 1. Using INT Function Steps: Click on cellD5....
如果您只想以整数来计算年龄,则可以使用Calculate age based onbirthday功能来快速处理它。 Kutools for Excel,与超过300方便的功能,使您的工作更加轻松。 免费下载免费全功能30天 后免费安装Kutools for Excel,请执行以下操作: 1.选择要放置年龄的单元格,然后单击Kutools>Formula Helper>Formula Helper ...
假設您之前已經記錄了會員的生日,現在想在Excel中快速計算每個會員的生日及其年齡。 如何輕鬆完成? Excel的Kutools“ 公式助手 收集公式 根據生日計算年齡 可以在Excel中輕鬆按出生日期計算年齡。 在Excel中按出生日期快速計算年齡點擊庫工具 > 公式助手 >配方 幫助器,然後在“公式幫助器”對話框中,選擇“數學公式類型...
用excel函数计算年龄几法(HowtocalculateagebyusingExcelfunction)HowtocalculateagebyusingExcelfunctionSource:CFANreleasetime:2009-07-02[commentstrip][anerroroccurredwhileprocessingthisdirective]Ageisoftenencounteredinpersonnelmanagement,wagestatisticscalculationanddateofbirthusingthesystemtimeinExcel,Ihavesomeresearchonth...
Method 1 – Using INT Function to Calculate Age on a Specific Date in Excel INT((Calculating Date – Date of Birth) / 365)) [/wpsm_box] This video cannot be played because of a technical error.(Error Code: 102006) Steps: Select the cell where you want to calculate the age. Here...
To calculate age in the format of Year + Month + Day, combine three DATEDIF formulas in Excel, each with a different unit argument. Select an empty cell to display the age, input the formula provided below, and hit the Enter key. Then, click on the cell with the result and drag its...
2) If you want to get the next year’s age based on the birthdate, just add 1 in the formula such as =DATEDIF(B2,TODAY(),"y")+1. 3.12 Calculate age in years, month and days format by given birthday If you want to calculate age based on a given birthdate, and...