Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Age function how to
Will someone PLEASE tell me in detail exactly how to use the code below to
obtain a viable result. Where do you put the code How do you call it From where Thanks very much for any help you provide Function Age(Date1 As Date, Date2 As Date) As String Dim Y As Integer Dim M As Integer Dim D As Integer Dim Temp1 As Date Temp1 = DateSerial(Year(Date2), Month(Date1), Day(Date1)) Y = Year(Date2) - Year(Date1) + (Temp1 Date2) M = Month(Date2) - Month(Date1) - (12 * (Temp1 Date2)) D = Day(Date2) - Day(Date1) If D < 0 Then M = M - 1 D = Day(DateSerial(Year(Date2), Month(Date2) + 1, 0)) + D + 1 End If Age = Y & " years " & M & " months " & D & " days" End Function -- Norton Virus checker 2003 says this email is clean |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel Data Validation/Lookup function does function correcty | Excel Worksheet Functions | |||
copy of excel file not showing formulal/function in the function b | Excel Discussion (Misc queries) | |||
LINKEDRANGE function - a complement to the PULL function (for getting values from a closed workbook) | Excel Worksheet Functions | |||
Offset function with nested match function not finding host ss. | Excel Worksheet Functions | |||
Emulate Index/Match combo function w/ VBA custom function | Excel Worksheet Functions |