Prev Previous Post   Next Post Next
  #11   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default Excel, date

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
TRYING TO SET UP EXCEL SPREADSHEET ON MY COMPUTER MEGTOM New Users to Excel 5 October 27th 05 03:06 AM
Excel Query Wizard Date Format aldsv Excel Discussion (Misc queries) 1 May 31st 05 12:44 PM
Excel file modification date GROSNER Excel Discussion (Misc queries) 5 March 4th 05 01:19 AM
Excel formula with date constraints Warrior Pope Excel Discussion (Misc queries) 3 January 28th 05 03:08 PM
In Excel 2003, entering date without slashes, the date is incorre. sj Excel Discussion (Misc queries) 6 January 6th 05 03:07 PM


All times are GMT +1. The time now is 12:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"