Click here to Skip to main content
15,914,074 members
Home / Discussions / Database
   

Database

 
QuestionBest Traffic Campaign (2385) Pin
Faisal Halari20-May-09 0:36
Faisal Halari20-May-09 0:36 
AnswerRe: Best Traffic Campaign (2385) [As if you hadn't guessed, this is an ADVERT. IGNORE!!! Pin
Henry Minute20-May-09 0:39
Henry Minute20-May-09 0:39 
Questionproblem populating a combo box Pin
Jondo24shoots19-May-09 22:22
Jondo24shoots19-May-09 22:22 
AnswerRe: problem populating a combo box Pin
Henry Minute20-May-09 0:41
Henry Minute20-May-09 0:41 
AnswerRe: problem populating a combo box Pin
saanj28-May-09 3:12
saanj28-May-09 3:12 
QuestionMaking the local database to a remote database server Pin
Subin Alex19-May-09 20:14
Subin Alex19-May-09 20:14 
AnswerRe: Making the local database to a remote database server Pin
Mycroft Holmes19-May-09 23:22
professionalMycroft Holmes19-May-09 23:22 
QuestionLoading an array in a custom user function... [modified] Pin
new_phoenix19-May-09 14:59
new_phoenix19-May-09 14:59 
I am working on a customized user function in MS Excel that breaks up the calendar into thirteen 28-day periods. The objective is to have as many 28 day periods in a row as possible. The standard monthly calendar consists of months in which some months have 30 days, while other months have 30 days, and occasionally there is a leap year with 28 days in February. However, for the month of December in the years 2009 and 2015, there are 35 days instead of 28 days.

In a spreadsheet, place the date 12/30/2007 and then pull the drag handle down so that the last cell is 12/31/2016. To the right of each of these cells is the place where the function cell result should be placed.

Now we need to create the place to add the code for a customized user function. This can be accomplished by pressing the Alt-F11 at the same time. A window opens in which code can be written for the function. Select "Insert" > "Module". Now there is a place to put the code.

Here is the code for the custom user function:

Option Explicit

Public Function ZodiacPeriod(dteInputDate)
    Dim dteStart As Date
    Dim dteEnd As Date
    Dim intDateCount As Integer
    Dim intRow As Integer
    Dim intColumn As Integer
    Dim intX As Integer
    Dim intCounter As Integer
    Dim intYear As Integer
    Dim arrArray(3290, 1)
    
    dteStart = #12/30/2007#
    dteEnd = #12/31/2016#
    intDateCount = DateDiff("d", dteStart, dteEnd)
    
    For intRow = 0 To intDateCount
        arrArray(intRow, intColumn) = dteStart
        dteStart = dteStart + 1
    Next
    
    intX = 1
    intCounter = 1
    
    For intRow = 0 To 3290
        arrArray(intRow, 1) = intX
        If (Year(arrArray(intRow, 0)) = 2009) Or _
            (Year(arrArray(intRow, 0)) = 2015) Then
            If (Month(arrArray(intRow, 0)) = 12) Then
                If intCounter <= 35 Then
                    If intX >= 14 Then
                        intX = 1
                    End If
                    intCounter = intCounter + 1
                Else
                    intX = intX + 1
                    intCounter = 1
                End If
            Else
                If intCounter <= 27 Then
                    If intX >= 14 Then
                        intX = 1
                    End If
                    intCounter = intCounter + 1
                Else
                    intX = intX + 1
                    intCounter = 1
                End If
            End If
        Else
            ' Normal processing
            If intCounter <= 27 Then
                If intX >= 14 Then
                    'What follows after 28th value of 13.
                    intX = 1
                End If
                'What follow the first cell formula is applied to
                intCounter = intCounter + 1
            Else
                intX = intX + 1
                intCounter = 1
            End If
        End If
    Next intRow

    'Now to go through the array and return the value
    For intRow = 0 To 3290
        If arrArray(intRow, 0) = dteInputDate Then
            ZodiacPeriod = arrArray(intRow, 1)
            Exit For
        End If
    Next intRow


End Function



Let us place the cursor into the cell into which the formula should be placed. Select "Insert" > "Functions" from the main menu and submenu.

Select the function name "ZodiacPeriod", and in the input box that pops up provide the left-most column in the spreadsheet that includes the date. Drag the drag handle on the bottom right corner of the cell to the bottom of the data thereby applying the formula to the other cells in the table. A related article can is as follows: http://office.microsoft.com/en-us/excel/HA011117011033.aspx?pid=CL100570551033[^]

Here is the question: Why is there a period 14 following the last 13th period?

modified on Tuesday, May 19, 2009 9:27 PM

QuestionMessage Closed Pin
19-May-09 14:44
abbasi12319-May-09 14:44 
RantRe: Hiring home based workers (2718) Pin
Ashfield19-May-09 20:59
Ashfield19-May-09 20:59 
GeneralQuery based on Effective Date Pin
Brady Kelly19-May-09 4:20
Brady Kelly19-May-09 4:20 
GeneralRe: Query based on Effective Date Pin
David Mujica19-May-09 4:44
David Mujica19-May-09 4:44 
GeneralRe: Query based on Effective Date Pin
Brady Kelly19-May-09 5:00
Brady Kelly19-May-09 5:00 
GeneralRe: Query based on Effective Date Pin
Luc Pattyn19-May-09 5:12
sitebuilderLuc Pattyn19-May-09 5:12 
Questionlogin problem Pin
Jondo24shoots19-May-09 3:16
Jondo24shoots19-May-09 3:16 
AnswerRe: login problem Pin
Mycroft Holmes19-May-09 14:37
professionalMycroft Holmes19-May-09 14:37 
GeneralRe: login problem Pin
Jondo24shoots19-May-09 22:13
Jondo24shoots19-May-09 22:13 
GeneralRe: login problem Pin
Mycroft Holmes19-May-09 23:20
professionalMycroft Holmes19-May-09 23:20 
QuestionHow do i insert and retrive images in a sql server database 2000 or 2005??? Pin
ma.amer18-May-09 21:33
ma.amer18-May-09 21:33 
AnswerRe: How do i insert and retrive images in a sql server database 2000 or 2005??? Pin
Giorgi Dalakishvili18-May-09 23:12
mentorGiorgi Dalakishvili18-May-09 23:12 
Questioncouldnot find installable ISAM Pin
hrishiS18-May-09 19:45
hrishiS18-May-09 19:45 
AnswerRe: couldnot find installable ISAM Pin
Vimalsoft(Pty) Ltd18-May-09 22:19
professionalVimalsoft(Pty) Ltd18-May-09 22:19 
QuestionSQLExpress 2008 Issue ? Pin
Mohammad Dayyan18-May-09 8:23
Mohammad Dayyan18-May-09 8:23 
NewsFFDPERL - Flat file database for perl Pin
wickedxter18-May-09 7:52
wickedxter18-May-09 7:52 
QuestionColumn Constraints Pin
jonhbt18-May-09 2:28
jonhbt18-May-09 2:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.