Home |
Search |
Today's Posts |
#11
![]() |
|||
|
|||
![]()
On Sun, 13 Nov 2005 15:11:01 -0800, "Chris"
wrote: I have on cell that has an original manfg. date 1/1/90 (this date will change) the next hydro date is either 3 or 5 years depending on the date. prior to 1/1/91 cylinder must be done every three years and after 1/1/91 they must be done every 5 years. I am stuck on the formula asd I have it now =IF($D$3<B16,1095+D3,1825+D3) any assitance would be of great help. Thnaks You can write a User Defined Function in VBA that will do this. <alt<F11 opens the VB Editor. Ensure your project is highlighted in the Project Explorer window, then Insert/Module and paste the code below into the window that opens. You can then use the formula =NextHydro(mfg_date) to compute the next hydro date. ============================ Option Explicit Function NextHydro(Mfg_date) As Date Dim Three_Five As Date Dim Intvl As Double Three_Five = DateSerial(1990, 12, 31) If Mfg_date Three_Five Then Intvl = 5 Else: Intvl = 3 End If NextHydro = DateAdd("yyyy", Intvl, Mfg_date) Do Until NextHydro = Date NextHydro = DateAdd("yyyy", Intvl, NextHydro) Loop End Function ================================ --ron |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
TRYING TO SET UP EXCEL SPREADSHEET ON MY COMPUTER | New Users to Excel | |||
Excel Query Wizard Date Format | Excel Discussion (Misc queries) | |||
Excel file modification date | Excel Discussion (Misc queries) | |||
Excel formula with date constraints | Excel Discussion (Misc queries) | |||
In Excel 2003, entering date without slashes, the date is incorre. | Excel Discussion (Misc queries) |